aws / aws/aws-cdk

CfnTagAssociation: Multiple resources created by Synth

Open
#29,756 5 comments 1 reaction 0 assignees View on GitHub
@aws-cdk/aws-lakeformation bug effort/small needs-cfn p3 package/tools
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the bug

Adding LakeFormation Tags via Python CDK to Glue Tables results in this error : `Resource parameter must have exactly 1 resource specified but 2 were provided.`

### Expected Behavior

Tags are assigned correctly when CDK synthesizes the underlying cloudformation resource.

### Current Behavior

Cloudformation Resource is synthesized with duplicate resources being attached to the LakeFormation TAG leading to failure in deployment.

### Reproduction Steps

Create a tag association in a Stack using code similar to this. This results in a synthesized resource with 2 resources in the TAG which fails to deploy.

> association = CfnTagAssociation(
> self,
> f"{tag}TagAssociation",
> lf_tags=[
> CfnTagAssociation.LFTagPairProperty(
> catalog_id=Aws.ACCOUNT_ID,
> tag_key=f"{namespace}-{tag}",
> tag_values=[tag_value],
> )
> ],
> resource=CfnTagAssociation.ResourceProperty(
> catalog={},
> table=CfnTagAssociation.TableResourceProperty(
> catalog_id=Aws.ACCOUNT_ID,
> name=table_name,
> database_name=database.database_name,
> ),
> ),
> )

### Possible Solution

_No response_

### Additional Information/Context

_No response_

### CDK CLI Version

2.136.0 (build 94fd33b)

### Framework Version

_No response_

### Node.js Version

v18.14.2

### OS

Ubuntu 22.04

### Language

Python

### Language Version

3.9.18

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the supplied Python CfnTagAssociation example and inspect the synthesized CloudFormation template for the duplicate resources in the LakeFormation tag association. Done means synthesis emits exactly one associated resource and the resulting deployment no longer fails with the resource-parameter error.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.