Is there a way to unit test AWS Cloudformation template

后端 未结 3 1823
遇见更好的自我
遇见更好的自我 2020-12-25 11:10

When we say that cloudformation is \'Infrastructure as Code\', the next question that immediately comes to mind is how can this code be tested. Can we do some sort of basic

3条回答
  •  时光说笑
    2020-12-25 11:26

    The testing as you described (at least beyond JSON parsing) can be achieved partially by parsing CloudFormation templates by programmatic libraries that are used to generate/read templates. They do not test the template explicitly but can throw an exception or error upon conditions where you use a property that is not defined for a resource.

    Check out go-cloudformation: https://github.com/crewjam/go-cloudformation

    Other than that you need to run the stack to see errors. I believe that testing IaaC is one of the main challenges in infrastructure automation. Not only unit testing but also integration testing and continuous validation.

提交回复
热议问题