admin管理员组文章数量:1122846
I have the following mappings within a YAML CloudFormation file; dev, preprod and prod represent the environments. It contains roles and configurations within those environments (for a glue usage profile).
Code:
Mappings:
GlueUsageProfileMappings:
dev:
DevRole:
MinDPUs: "1"
MaxDPUs: "40"
AllowedWorkerTypes: ["Standard", "G.1X", "G.2X"]
RoleName: "devonly_role"
AdminRole:
MinDPUs: "1"
MaxDPUs: "140"
AllowedWorkerTypes: ["Standard", "G.1X", "G.2X", "G.4X"]
RoleName: "admin_role"
preprod:
DataEngineerRole:
MinDPUs: "1"
MaxDPUs: "40"
AllowedWorkerTypes: ["Standard", "G.1X", "G.2X"]
RoleName: "data_engineer_role"
AdminRole:
MinDPUs: "1"
MaxDPUs: "140"
AllowedWorkerTypes: ["Standard", "G.1X", "G.2X", "G.4X"]
RoleName: "admin_role"
prod:
DataEngineerRole:
MinDPUs: "1"
MaxDPUs: "40"
AllowedWorkerTypes: ["Standard", "G.1X", "G.2X"]
RoleName: "data_engineer_role"
AdminRole:
MinDPUs: "1"
MaxDPUs: "140"
AllowedWorkerTypes: ["Standard", "G.1X", "G.2X", "G.4X"]
RoleName: "admin_role"
I thought it looked okay,however when running a linter: cfn-lint -t ci/*.yml --ignore-checks W1001,W3005,E2010, I get the following error messages:
E7001 Mapping GlueUsageProfileMappings has invalid property at DevRole ci/master-stack.yml:433:7
E7001 Mapping GlueUsageProfileMappings has invalid property at AdminRole ci/master-stack.yml:438:7
E7001 Mapping GlueUsageProfileMappings has invalid property at DataEngineerRole ci/master-stack.yml:445:7
I've pasted this into AI tools, but they can't seem to find the issue and say my code is fine, I looked on StackOverflow and the only similar issue suggested removing the template definition at the top of the file, which I did but that didn't work either. Am I missing something here? Or maybe it is caused by something else in my file?
I looked at the docs for mappings here and can't seem to find out what I am doing wrong: .html
I have the following mappings within a YAML CloudFormation file; dev, preprod and prod represent the environments. It contains roles and configurations within those environments (for a glue usage profile).
Code:
Mappings:
GlueUsageProfileMappings:
dev:
DevRole:
MinDPUs: "1"
MaxDPUs: "40"
AllowedWorkerTypes: ["Standard", "G.1X", "G.2X"]
RoleName: "devonly_role"
AdminRole:
MinDPUs: "1"
MaxDPUs: "140"
AllowedWorkerTypes: ["Standard", "G.1X", "G.2X", "G.4X"]
RoleName: "admin_role"
preprod:
DataEngineerRole:
MinDPUs: "1"
MaxDPUs: "40"
AllowedWorkerTypes: ["Standard", "G.1X", "G.2X"]
RoleName: "data_engineer_role"
AdminRole:
MinDPUs: "1"
MaxDPUs: "140"
AllowedWorkerTypes: ["Standard", "G.1X", "G.2X", "G.4X"]
RoleName: "admin_role"
prod:
DataEngineerRole:
MinDPUs: "1"
MaxDPUs: "40"
AllowedWorkerTypes: ["Standard", "G.1X", "G.2X"]
RoleName: "data_engineer_role"
AdminRole:
MinDPUs: "1"
MaxDPUs: "140"
AllowedWorkerTypes: ["Standard", "G.1X", "G.2X", "G.4X"]
RoleName: "admin_role"
I thought it looked okay,however when running a linter: cfn-lint -t ci/*.yml --ignore-checks W1001,W3005,E2010, I get the following error messages:
E7001 Mapping GlueUsageProfileMappings has invalid property at DevRole ci/master-stack.yml:433:7
E7001 Mapping GlueUsageProfileMappings has invalid property at AdminRole ci/master-stack.yml:438:7
E7001 Mapping GlueUsageProfileMappings has invalid property at DataEngineerRole ci/master-stack.yml:445:7
I've pasted this into AI tools, but they can't seem to find the issue and say my code is fine, I looked on StackOverflow and the only similar issue suggested removing the template definition at the top of the file, which I did but that didn't work either. Am I missing something here? Or maybe it is caused by something else in my file?
I looked at the docs for mappings here and can't seem to find out what I am doing wrong: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/mappings-section-structure.html
Share Improve this question asked Nov 22, 2024 at 11:44 IVB_CODINGIVB_CODING 235 bronze badges1 Answer
Reset to default 0The issue stems from how AWS CloudFormation Mappings work. In CloudFormation, Mappings are key-value pairs that allow you to create mappings between logical names and their corresponding values. The structure you’ve written includes nested dictionaries (e.g., DevRole and AdminRole), which is not directly supported in the standard Mappings.
These are the two Constraints in CloudFormation Mapping:
1 - Mappings allow a key-value lookup but don’t support complex structures like nested dictionaries.
2 - Each value in the mapping must be either a simple string or a list.
and that's already stated in your provided link:
The key must be a map of name-value pairs and unique within the mapping.
The name-value pair is a label, and the value to map. By naming the values, you can map more than one set of values to a key.
The keys in mappings must be literal strings.
The values can be of type String or List.
To make this work you need to flatten the mapping structure, here's an example of how it would look like :
Mappings:
GlueUsageProfileMappings:
dev:
DevRole_MinDPUs: "1"
DevRole_MaxDPUs: "40"
DevRole_AllowedWorkerTypes: ["Standard", "G.1X", "G.2X"]
DevRole_RoleName: "devonly_role"
AdminRole_MinDPUs: "1"
AdminRole_MaxDPUs: "140"
AdminRole_AllowedWorkerTypes: ["Standard","G.1X","G.2X","G.4X"]
AdminRole_RoleName: "admin_role"
本文标签: amazon web servicesHow to fix invalid properties for CloudFormation mappings (YAML)Stack Overflow
版权声明:本文标题:amazon web services - How to fix invalid properties for CloudFormation mappings (YAML) - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736304003a1932078.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论