question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(Construct): (Removing reference in another stack, is causing removal in original stack)

See original GitHub issue

Describe the bug

I have a StringParameter in a Stack

RuleCreation = new StringParameter(this, "param-rule-creation", new StringParameterProps()
            {
                ParameterName = $"{DeploymentPrefix}-rulecreation",
                Description = "Rule Creation Enabled",
                StringValue = ruleCreation
            });

This is being used in another Construct in a NetworkLoadBalancedTaskImageOptions()
like this

 Secrets = new Dictionary<string, Secret> {
                        { "Logging:LogLevel:Default" ,Secret.FromSsmParameter(props.BaseResources.LogLevel) },
                        { "RuleCreation", Amazon.CDK.AWS.ECS.Secret.FromSsmParameter(props.BaseResources.RuleCreation) },

After it has been deployed, if I REMOVE the “RuleCreation” String Parameter from the “Secrets” dictionary and do a Cdk diff

It shows as it being removed from the Stack, even though it is still in the Stack. and hence I can not cdk deploy the change to remove, as the deploy of the Stack complains that I can not remove “RuleCreation” as it is used in the Construct.

Expected Behavior

I should be able to remove the “Secret” from the Construct, and it should remain in the Stack

Current Behavior

cdk diff/deploy attempts to remove the StringParameter from the Stack, when it should leave it

It should only have removed the reference in the Construct

Reproduction Steps

            {
                ParameterName = $"{DeploymentPrefix}-rulecreation",
                Description = "Rule Creation Enabled",
                StringValue = ruleCreation
            });

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

cdk 2.2.26

Framework Version

core 3.1

Node.js Version

16.15.0

OS

Windows

Language

.NET

Language Version

.net 3.1

Other information

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:16 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
CliveBennettcommented, Jun 9, 2022

All good, ill see if I can follow your tip above, otherwise ill just drop the stacks and recreate, as I cant just remove the reference as it complains. There’s something subtle going on that I just don’t understand 😦

Thanks for the help.

0reactions
github-actions[bot]commented, Aug 27, 2022

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CDK tips, part 3 – how to unblock cross-stack references
In the first one, you remove the reference from the consuming Stack, while keeping the exports in the producing Stack. Once the updated...
Read more >
Update CloudFormation stacks that are failing because of ...
If you delete a resource that was created by a CloudFormation stack, then your stack fails to update, and you get an error...
Read more >
How to remove reference of file Xcode? - Stack Overflow
Try opening the project folder through a separate text editor and do a text search of the names of the old files. –...
Read more >
Shrink, obfuscate, and optimize your app - Android Developers
Learn how to shrink code in your release build to remove unused code and ... based on references to classes in your app's...
Read more >
Stacks - CDK for Terraform - HashiCorp Developer
For example, you may want to create multiple S3 Buckets with different configurations. Instances that share the same stack parent element are considered...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found