Skip to content

(imagebuilder): (amiDistributionConfiguration false type any) #34407

Closed
@DaLaTrex

Description

@DaLaTrex

Describe the bug

the amiDistributionConfiguration in imagebuilder has the type any, so that the AmiDistributionConfigurationProperty can not be used.

Regression Issue

  • Select this option if this issue appears to be a regression.

Last Known Working CDK Library Version

No response

Expected Behavior

to function like the ssmParameterConfigurations property

IResolvable | AmiDistributionConfigurationProperty

The newer distribution properties like ssmParameterConfigurations have Type:
IResolvable | IResolvable | SsmParameterConfigurationProperty[]

Current Behavior

type any

so that we have to write the exact CFN Json to function properly

Reproduction Steps

#!/usr/bin/env node
import * as cdk from 'aws-cdk-lib';
import { Construct } from 'constructs';

const app = new cdk.App();
class CdkTestStack extends cdk.Stack {
  constructor(scope: Construct, id: string, props?: cdk.StackProps) {
    super(scope, id, props);

    const amiDistributionConfiguration: cdk.aws_imagebuilder.CfnDistributionConfiguration.AmiDistributionConfigurationProperty = {
      amiTags: {
        amiTagsKey: 'amiTags',
      },
      description: 'description',
      name: 'amiName',
      targetAccountIds: ['123456789012']
    }

    const ssmParameter: cdk.aws_imagebuilder.CfnDistributionConfiguration.SsmParameterConfigurationProperty = {
      parameterName: 'testParamter',
      amiAccountId: '123456789012'
    }

    const distributionConfiguration = new cdk.aws_imagebuilder.CfnDistributionConfiguration(this, 'test', {
      name: 'DistributionName',
      distributions: [{
        region: 'region',
        amiDistributionConfiguration: amiDistributionConfiguration,
        ssmParameterConfigurations: [ssmParameter]
      }]
    })
  }
}
new CdkTestStack(app, 'CdkTestStack', {

});

after that perform a cdk synth, and look at the resources section. You should see that all props for AmiDistributionConfiguration are written as provided in amiDistributionConfigurationProperty, but in the CFN Template they should starting with a capital letter.

CFN docs

Possible Solution

type IResolvable | AmiDistributionConfigurationProperty

Additional Information/Context

No response

AWS CDK Library version (aws-cdk-lib)

2.195.0

AWS CDK CLI version

2.1014.0

Node.js Version

22.14

OS

MacOS

Language

TypeScript

Language Version

Typescript 5.6.3

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-imagebuilderRelated to EC2 Image BuilderbugThis issue is a bug.effort/mediumMedium work item – several days of effortp3

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions