How do I troubleshoot CloudFormation module errors?

2 minute read
0

I want to resolve the module errors I get in AWS CloudFormation.

Resolution

CloudFormation modules help to simplify infrastructure as code. They offer transparency and manageability across stack templates. However, you might come across errors during module creation and usage.

Error: "Module fragment might be valid, but there are warnings from cfn-lint: Invalid Property Resources/<Resource-Name>/Properties/<PropertyName>. Did you mean <Valid-PropertyName>? (from rule E3002: Resource properties are invalid)"

This error might occur when you create a module.

Follow these steps to resolve this error:

  1. Make sure that the CloudFormation template is valid.

    Validate the template in the fragments folder using CloudFormation Linter on the GitHub website. Use this before you create the module to catch potential issues early.

  2. For any other errors, check the rpdk.log file that was created during the initialization of the CloudFormation module.

    The rpdk.log file contains the detailed logs that are generated when you run the cfn command. Analyze the logs for insights into the sequence of actions and potential errors.

Error: "Properties validation failed for resource <stack-name> with message: #/<Property>: failed validation constraint for keyword [pattern]"


This error might occur when you use the module. Verify the source of properties validation failure.

  1. Check parameter constraints.

    Make sure that the properties meet the specified parameters constraints. This includes data types and patterns of the CloudFormation template used when the module was created.

  2. Inspect resource property constraints.

    Investigate constraints on the properties of the actual resource within the CloudFormation template.

    Setting the Amazon Simple Storage Service (Amazon S3) bucket name as Test without constraints in the CloudFormation module template parameters causes a validation error. The input complies with parameter constraints, but because the input uses an uppercase letter, it violates the S3 bucket naming convention.

Related information

Introducing AWS CloudFormation modules

Using modules to encapsulate and reuse resource configurations

CloudFormation CLI command reference

AWS OFFICIAL
AWS OFFICIALUpdated 2 months ago