aws / aws/aws-cdk

aws_image_builder: resource template validation warnings

Open
#34,758 2 comments 0 reactions 0 assignees View on GitHub
@aws-cdk/aws-imagebuilder bug p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the bug

The problem is just related to CLI output and this may be a CloudFormation issue and not CDK. The distribution config updates properly but the messages received in the terminal indicate a template validation issue. Both the CDK docs and the CloudFormation reference has these properties so they are valid properties.

### Regression Issue

- [ ] Select this option if this issue appears to be a regression.

### Last Known Working CDK Library Version

_No response_

### Expected Behavior

The stack update completes with no warning messages about a template validation problem.

### Current Behavior

These are the terminal messages from the CDK deployment.

GoldImageMainStack: start: Building GoldImageMainStack Template
GoldImageMainStack: success: Built GoldImageMainStack Template
GoldImageMainStack: start: Publishing GoldImageMainStack Template (current_account-current_region)
GoldImageMainStack: start: Publishing ResourceStack Nested Stack Template (current_account-current_region)
GoldImageMainStack: success: Published GoldImageMainStack Template (current_account-current_region)
GoldImageMainStack: success: Published ResourceStack Nested Stack Template (current_account-current_region)
GoldImageMainStack: deploying... [1/1]
GoldImageMainStack: creating CloudFormation changeset...
GoldImageMainStack | 0/3 | 1:40:06 PM | UPDATE_IN_PROGRESS | AWS::CloudFormation::Stack | GoldImageMainStack User Initiated
GoldImageMainStack | 0/3 | 1:40:09 PM | UPDATE_IN_PROGRESS | AWS::CloudFormation::Stack | ResourceStack.NestedStack/ResourceStack.NestedStackResource (ResourceStackNestedStackResourceStackNestedStackResourceC46BA6CF)
GoldImageMainStack-ResourceStackNestedStackResourceStackNestedStackResourceC46BA6CF-ESC8S90G17F | 0/3 | 1:40:10 PM | UPDATE_IN_PROGRESS | AWS::CloudFormation::Stack | GoldImageMainStack-ResourceStackNestedStackResourceStackNestedStackResourceC46BA6CF-ESC8S90G17F User Initiated
GoldImageMainStack-ResourceStackNestedStackResourceStackNestedStackResourceC46BA6CF-ESC8S90G17F | 0/3 | 1:40:13 PM | UPDATE_IN_PROGRESS | AWS::ImageBuilder::DistributionConfiguration | ResourceStack/DistributionConfiguration (DistributionConfiguration)
GoldImageMainStack-ResourceStackNestedStackResourceStackNestedStackResourceC46BA6CF-ESC8S90G17F | 0/3 | 1:40:15 PM | UPDATE_IN_PROGRESS | AWS::ImageBuilder::DistributionConfiguration | ResourceStack/DistributionConfiguration (DistributionConfiguration) Resource template validation failed for resource DistributionConfiguration as the template has invalid properties. Please refer to the resource documentation to fix the template.
Properties validation failed for resource DistributionConfiguration with message:
#/Distributions/0/AmiDistributionConfiguration: extraneous key [description] is not permitted
#/Distributions/0/AmiDistributionConfiguration: extraneous key [targetAccountIds] is not permitted
#/Distributions/0/AmiDistributionConfiguration: extraneous key [launchPermissionConfiguration] is not permitted
#/Distributions/0/AmiDistributionConfiguration: extraneous key [amiTags] is not permitted
GoldImageMainStack-ResourceStackNestedStackResourceStackNestedStackResourceC46BA6CF-ESC8S90G17F | 1/3 | 1:40:15 PM | UPDATE_COMPLETE | AWS::ImageBuilder::DistributionConfiguration | ResourceStack/DistributionConfiguration (DistributionConfiguration)
GoldImageMainStack-ResourceStackNestedStackResourceStackNestedStackResourceC46BA6CF-ESC8S90G17F | 2/3 | 1:40:16 PM | UPDATE_COMPLETE_CLEA | AWS::CloudFormation::Stack | GoldImageMainStack-ResourceStackNestedStackResourceStackNestedStackResourceC46BA6CF-ESC8S90G17F
GoldImageMainStack | 3/3 | 1:40:20 PM | UPDATE_COMPLETE | AWS::CloudFormation::Stack | ResourceStack.NestedStack/ResourceStack.NestedStackResource (ResourceStackNestedStackResourceStackNestedStackResourceC46BA6CF)
GoldImageMainStack | 4/3 | 1:40:21 PM | UPDATE_COMPLETE_CLEA | AWS::CloudFormation::Stack | GoldImageMainStack
GoldImageMainStack-ResourceStackNestedStackResourceStackNestedStackResourceC46BA6CF-ESC8S90G17F | 5/3 | 1:40:23 PM | UPDATE_COMPLETE | AWS::CloudFormation::Stack | GoldImageMainStack-ResourceStackNestedStackResourceStackNestedStackResourceC46BA6CF-ESC8S90G17F
GoldImageMainStack | 4/3 | 1:40:33 PM | UPDATE_COMPLETE | AWS::CloudFormation::Stack | ResourceStack.NestedStack/ResourceStack.NestedStackResource (ResourceStackNestedStackResourceStackNestedStackResourceC46BA6CF)
GoldImageMainStack | 5/3 | 1:40:33 PM | UPDATE_COMPLETE | AWS::CloudFormation::Stack | GoldImageMainStack

These are the messages that are problematic:

Properties validation failed for resource DistributionConfiguration with message:
#/Distributions/0/AmiDistributionConfiguration: extraneous key [description] is not permitted
#/Distributions/0/AmiDistributionConfiguration: extraneous key [targetAccountIds] is not permitted
#/Distributions/0/AmiDistributionConfiguration: extraneous key [launchPermissionConfiguration] is not permitted
#/Distributions/0/AmiDistributionConfiguration: extraneous key [amiTags] is not permitted

The stack update completes successfully even though there is a template validation error and the extraneous keys show updated when viewed in the console.

### Reproduction Steps

```
# Distribution Config
distributions: list[
awsib.CfnDistributionConfiguration.DistributionProperty
] = []
for distro in distro_config.get("distributions", []):
if distro.get("type") == "ami":
current_distro = awsib.CfnDistributionConfiguration.DistributionProperty(
region=distro.get("region"),
ami_distribution_configuration=awsib.CfnDistributionConfiguration.AmiDistributionConfigurationProperty(
ami_tags=distro.get("ami_tags"),
description=distro.get("description"),
kms_key_id=distro.get("kms_key"),
launch_permission_configuration=awsib.CfnDistributionConfiguration.LaunchPermissionConfigurationProperty(
organization_arns=distro.get("org_arns"),
organizational_unit_arns=distro.get("ou_arns"),
),
name=distro.get("name"),
target_account_ids=distro.get("accounts", []),
),
)
distributions.append(current_distro)

distribution_config = awsib.CfnDistributionConfiguration(
self,
"DistributionConfiguration",
description=distro_config.get("description", "default description"),
distributions=distributions,
name=distro_config.get("name", "default-distro-config-name"),
)
```

### Possible Solution

_No response_

### Additional Information/Context

_No response_

### AWS CDK Library version (aws-cdk-lib)

2.199.0

### AWS CDK CLI version

2.1019.0 (build e9c24a6)

### Node.js Version

v22.15.0

### OS

Windows 11

### Language

Python

### Language Version

Python 3.13.3

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the Python reproduction using aws-cdk-lib 2.199.0 and inspect the synthesized AWS::ImageBuilder::DistributionConfiguration template. Compare the emitted AmiDistributionConfiguration properties with the CloudFormation reference and the validation output. Done means the stack update completes without the reported extraneous-key warnings while retaining the configured properties.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, python, typescript
Domain
cloud, infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.