Cloudformation Bug: Tier Parameter Regex in AWS::ApplicationInsights::Application ComponentMonitoringSetting Resource

1

Hello, I’ve encountered a critical issue with the AWS::ApplicationInsights::Application resource, specifically within the ComponentMonitoringSetting structure.

According to the documentation (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-applicationinsights-application-componentmonitoringsetting.html) , the Tier field accepts values such as DEFAULT, SQL_SERVER, POSTGRESQL, etc.

However, the provided pattern (^[A-Z][[A-Z]_]*$) is invalid and prevents all supported values from passing validation. For example:

Tier: DEFAULT

Results in:

E3031 'DEFAULT' does not match '^[A-Z][[A-Z]_]*$'

The regex seems to incorrectly include [[A-Z]]* instead of [A-Z]*. This makes the resource unusable via CloudFormation. Please advise or fix this regex in both schema and documentation. According to API documentation DEFAULT is an allowed value: https://docs.aws.amazon.com/cloudwatch/latest/APIReference/API_DescribeComponentConfiguration.html#API_DescribeComponentConfiguration_ResponseSyntax

Code snippet:

Resources:
  ApplicationResourceGroup:
    Type: AWS::ResourceGroups::Group
    Properties:
      Name: "app-resource-group"
      ResourceQuery:
        Type: CLOUDFORMATION_STACK_1_0

  ApplicationInsightsMonitoring:
    Type: AWS::ApplicationInsights::Application
    Properties:
      ResourceGroupName: "app-resource-group"
      AutoConfigurationEnabled: 'false'
      OpsCenterEnabled: 'true'
      OpsItemSNSTopicArn: !Ref SupportTopic
      CustomComponents:
        - ComponentName: "ApiLambda"
          ResourceList:
            - !GetAtt Function.Arn
      ComponentMonitoringSettings:
        - ComponentName: "ApiLambda"
          Tier: DEFAULT
          ComponentConfigurationMode: DEFAULT
    DependsOn: ApplicationResourceGroup
1 Answer
0

You are correct in identifying an issue with the regex pattern for the Tier parameter in the AWS::ApplicationInsights::Application ComponentMonitoringSetting resource. The current regex pattern (^[A-Z][[A-Z]_]*$) is indeed incorrect and does not allow valid values like DEFAULT or SQL_SERVER.

This appears to be a documentation error in the CloudFormation resource specification. The correct regex pattern should be (^[A-Z][A-Z_]*$), which would allow for uppercase letters and underscores after the first character, matching the allowed values like DEFAULT, SQL_SERVER, and POSTGRESQL.

To work around this issue while waiting for AWS to correct the documentation and schema, you have a few options:

  1. Use the AWS CLI or SDK to create and manage your Application Insights application instead of CloudFormation. This bypasses the CloudFormation validation.

  2. If you must use CloudFormation, you could try using the AWS::ApplicationInsights::Application resource without specifying the Tier property in ComponentMonitoringSettings. Instead, rely on the ComponentConfigurationMode set to DEFAULT, which should apply recommended settings based on the component type.

  3. Another option is to create a custom resource in CloudFormation that uses the AWS SDK to create and manage the Application Insights application. This allows you to bypass the CloudFormation resource's validation while still managing the resource through your CloudFormation stack.

It's recommended to report this issue to AWS support so they can correct the documentation and the underlying schema for the CloudFormation resource. In the meantime, one of the above workarounds should allow you to proceed with your deployment.
Sources
AWS::ApplicationInsights::Application ComponentMonitoringSetting - AWS CloudFormation
Create and configure CloudWatch Application Insights monitoring using CloudFormation templates - Amazon CloudWatch
Using regular expressions in CloudFormation templates - AWS CloudFormation

profile picture
answered 2 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions