-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Description
Description
Problem is that the cloudformation stacks sometimes do not follow the correct spacing or yaml spec when it is modified. We find out upon apply instead of during the init/plan phase.
We can use something like cfn-lint or other tools to catch this but it would be nice to have it in native in the provider so we do not have to use external tools.
For example, if we want to make sure the json or yaml is correct, we can do something like this before we create the resources that depend on these templates.
locals {
yaml_object = yamldecode(file("${path.module}/stack.yaml"))
json_object = jsondecode(file("${path.module}/stack.json"))
}
I tried this and received an error because the cloudformation yaml contains some cloudformation-isms that are not compliant with the YAML spec.
locals {
raw_file = file("${path.module}/cfstack.yaml")
yaml_object = yamldecode(local.raw_file)
}
If there was a provider function to do this, that would make it much easier to turn this into a parsable object.
e.g. cfdecode
locals {
raw_file = file("${path.module}/cfstack.yaml")
yaml_object = provider::aws::cfdecode(local.raw_file)
}
Affected Resource(s) or Data Source(s)
aws_cloudformation_stack
Potential Terraform Configuration
See above
References
N/A
Would you like to implement the enhancement?
No