config.json placeholder to support cloudformation / terraform packaging
- Dominant language
- Python
- Stars
- 11.1k
- Forks
- 1k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 2
Description
Hey Guys,
We have a custom pipeline for deploying infrastructure code and we would like to integrate into existing pipeline generated cloudformation code.
Idea is to have in one place dev and prod config, BUT in the prod config I would like to have placeholders to the cloudformation / terraform variables. Values or arns can come from outside, other parts of infrastructure code. During the packaging step these placeholders can be resolved as references to cloudformation / terraform variables.
```
{
"version": "2.0",
"app_name": "foo",
"api_gateway_stage": "api",
"stages": {
"dev": {
...
},
"prod": {
"api_gateway_endpoint_type": "PRIVATE",
"api_gateway_endpoint_vpce": "$ApiGatewayVpce",
"autogen_policy": false,
"manage_iam_role": false,
"iam_role_arn": "$IamRoleArn",
"lambda_functions": {
"api_handler": {
"subnet_ids": [
"$SubnetIds"
],
"security_group_ids": [
"$SecurityGroupIds"
],
"iam_role_arn": "$IamRoleArn"
}
}
}
```
My current workaround is to keep everything in the `template` and override these placeholders afterwards in the pipeline. Disadvantage here is I need to generate cloudformation upfront to be able to grab parts which I will override later on.
```
Parameters:
SubnetIds:
Type: List
SecurityGroupIds:
Type: List
ApiGatewayVpce:
Type: String
IamRoleArn:
Type: String
Resources:
APIHandler:
Properties:
CodeUri: s3://bucket/deployment.zip
Role:
Ref: IamRoleArn
VpcConfig:
SecurityGroupIds:
Ref: SecurityGroupIds
SubnetIds:
Ref: SubnetIds
```
I'm new to the chalice and maybe I'm missing something then please point me out to the proper documentation. We are not considering right now move to AWS CD. Nevertheless, would the described feature be useful from the project evolving perspective?
Contributor guide
Research direction
Start by tracing the config.json handling and packaging step described in the issue, then compare how dev and prod values are currently resolved. No implementation file or test is named; done would require an agreed design and verified resolution of placeholders such as $ApiGatewayVpce, $IamRoleArn, $SubnetIds, and $SecurityGroupIds into the generated infrastructure template.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, python, terraform
- Domain
- cloud, infrastructure
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100