aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.52k stars 3.86k forks source link

aws_signer: Removing tags to stack containing signing profile causes errors #31392

Open cjhelloletsgo opened 1 week ago

cjhelloletsgo commented 1 week ago

Describe the bug

https://github.com/aws/aws-cdk/issues/30013

Regression Issue

Last Known Working CDK Version

No response

Expected Behavior

Error is still happening, just on removal instead of adding

Current Behavior

Removing tag from stack causes deployment error

Reproduction Steps

Clone github repo, deploy stack, comment out or remove tag, stack will fail to deploy

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.157.0 (build 7315a59)

Framework Version

No response

Node.js Version

v20.17.0

OS

Ubuntu 24.04

Language

Python

Language Version

No response

Other information

No response

khushail commented 1 week ago

Hi @cjhelloletsgo , thanks for reporting this issue.

I reproduced this error by first adding the tags( sample taken from old issue #30013,works as expected ) for stack containing signing profile. once deployed, the tags are successfully added

in lib/signer_issue-stack.ts

export class SignerIssueStack extends cdk.Stack {
  constructor(scope: Construct, id: string, props?: cdk.StackProps) {
    super(scope, id, props);

    const signing_profile = new signer.SigningProfile(this, "Signing Profile", {
      platform: signer.Platform.AWS_LAMBDA_SHA384_ECDSA,
    });

    const code_signing_config = new lambda_.CodeSigningConfig(this, "Code Signing Config", {
      signingProfiles: [
        signing_profile,
      ],
      description: `CDK Signing Config for ${Stack.of(this).stackName}`,
      untrustedArtifactOnDeployment: lambda_.UntrustedArtifactOnDeployment.WARN,
    });

in bin/signer_issue.ts

    //adding the tags 
    cdk.Tags.of(stackSigner).add("newtag", "signerStack");

Console output - stack with tag-

Screenshot 2024-09-11 at 12 21 15 PM

but removing the tags

cdk.Tags.of(stackSigner).remove("newtag");

leads to this error -

Screenshot 2024-09-11 at 11 45 05 AM

However adding/removing tags to stack(without signing profile) works as expected.

Marking it as P2 as it won't be immediately addressed by the team but team would be happy to welcome PR contributions from the community.