aws-cloudformation / aws-cloudformation/cloudformation-coverage-roadmap
AWS::Cloudformation::Modules-Parameters-Object Type
- Dominant language
- No language data
- Stars
- 1.1k
- Forks
- 62
- PR merge metrics
- No merged PRs in 30d
Description
It is currently undocumented, but it is possible to use objects as values for module parameters. This behavior should be formalized into a documented feature and objects should become valid types in schama.json
Example Module:
fragments/ecs-task-definition.yaml
```
Description: Create task definition
Parameters:
Name:
Description: The application name.
Type: String
EnvironmentVars:
Type: String
Description: List of key value pair environment variable.
Secrets:
Type: String
Description: List of key value pair for secret environment variable resolved from secrets manager.
ContainerImage:
Type: String
Description: The container Image to run.
Resources:
TaskDefinition:
Type: AWS::ECS::TaskDefinition
Properties:
ContainerDefinitions:
- Image: !Ref 'ContainerImage'
Environment: !Ref EnvironmentVars
Secrets: !Ref Secrets
Name: !Ref 'Name'
Cpu: 256
Memory: 512
Outputs:
TaskDefinition:
Description: Logical ID of the ECS Task Definition
Value: !Ref 'TaskDefinition'
```
Example use of the above module:
```
Resources:
TaskDefinition:
Type: Organization::ECS::TaskDefinition::MODULE
Properties:
Name: test-1
EnvironmentVars:
- Name: TEST
Value: TEST
Secrets:
- Name: SECRET
ValueFrom: arn:aws:secretsmanager:us-west-2:1111111111:secret:test/test-1
ContainerImage: harbor.registry.com/group/test:latest
```
Though the Type for `EnvironmentVars` and `Secrets` is "String", it is possible to pass object values into it. This is incredibly useful especially in the above example with ECS task definitions. If modules continues to support this behavior (which it should) it should also be possible to define a parameters type as an `object` in the schema. Currently module parameters that require objects as values are documented in the registry as requiring string values.
Contributor guide
Assessment
This issue has not been assessed yet.