cloudformation-template icon indicating copy to clipboard operation
cloudformation-template copied to clipboard

Not able to create/update aws/main.yaml when not providing LogArchives and CloudTrails

Open mikevoets opened this issue 8 months ago • 0 comments

Expected Behavior

The stack deploys without failures.

Actual Behavior

CloudFormation fails with: Transforms defined as maps require Name key.

Steps to Reproduce the Problem

Using AWS CDK v2:

export class DatadogStack extends cdk.Stack {
  constructor(scope: Construct, id: string, props: DatadogStackProps) {
    super(scope, id, props);

    const mainTemplate = new cfn_inc.CfnInclude(this, 'MainTemplate', {
      templateFile: 'aws/main.yaml',
      parameters: {
        ExternalId: props.externalId,
        DdApiKeySecretArn: props.apiKeySecretArn,
      },
      loadNestedStacks: {
        DatadogPolicyMacroStack: {
          templateFile: 'aws/datadog_policy_macro.yaml',
        },
        DatadogIntegrationRoleStack: {
          templateFile: 'aws/datadog_integration_role.yaml',
        },
      },
    });
    ...
}

See the synthetized nested DatadogIntegrationRoleStack template in cdk.out. The DatadogIntegrationRole has the following empty transforms, which causes this issue:

"Policies": [
     {
      "PolicyDocument": {
       "Version": "2012-10-17",
       "Statement": [
        {
         ...
        }
       ]
      },
      "PolicyName": "DatadogAWSIntegrationPolicy"
     },
     {
      "Fn::Transform": {}
     },
     {
      "Fn::Transform": {}
     }
    ],
    ...

Specifications

  • Datadog CloudFormation template version: 2010-09-09

Stacktrace

N/A, see above

mikevoets avatar Nov 12 '23 23:11 mikevoets