Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

SSM: StringParameter.ValueFromLookup returns old value #28956

Closed
werebear73-tritelph opened this issue Feb 1, 2024 · 2 comments
Closed

SSM: StringParameter.ValueFromLookup returns old value #28956

werebear73-tritelph opened this issue Feb 1, 2024 · 2 comments
Labels
@aws-cdk/aws-ssm Related to AWS Systems Manager bug This issue is a bug. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. effort/medium Medium work item – several days of effort p2 response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@werebear73-tritelph
Copy link

Describe the bug

The function StringParameter.ValueFromLookup doesn't return the newest value of the of the SSM Parameter.

Expected Behavior

That the StringParameter.ValueFromLookup function returns the most recent value of the SSM Parameter.

Current Behavior

StringParameter.ValueFromLookup returns an older value even though you even destroy the Parameter and recreate it. I even tried deleting the cdk.out folder but the original value of the Parameter is returned.

Reproduction Steps

Create a StringParameter in a separate stack and project. Read the value in a different Project. Go back to the original project and destroy the stack and recreate. Return to the second project and the value with still be the original value.

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.124.0 (build 4b6724c)

Framework Version

No response

Node.js Version

v20.10.0

OS

Wiindows 11

Language

.NET

Language Version

8.0.101

Other information

No response

@werebear73-tritelph werebear73-tritelph added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Feb 1, 2024
@github-actions github-actions bot added the @aws-cdk/aws-ssm Related to AWS Systems Manager label Feb 1, 2024
@pahud
Copy link
Contributor

pahud commented Feb 5, 2024

This is because the value was cached in your cdk.context.json and will not return the newer value unless the cache is reset.

For example if I lookup the foo parameter for the first time

const stringValue = ssm.StringParameter.valueFromLookup(this, 'foo');

and check cdk.context.json I will see the cache with the key "ssm:account=ACCOUNT_ID:parameterName=foo:region=us-east-1"

I can reset it with

npx cdk context --reset ssm:account=ACCOUNT_ID:parameterName=foo:region=us-east-1

See the document about cdk context for more details
https://docs.aws.amazon.com/cdk/v2/guide/context.html

Let me know if it works for you.

@pahud pahud added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. effort/medium Medium work item – several days of effort p2 and removed needs-triage This issue or PR still needs to be triaged. labels Feb 5, 2024
Copy link

github-actions bot commented Feb 7, 2024

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.

@github-actions github-actions bot added closing-soon This issue will automatically close in 4 days unless further comments are made. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Feb 7, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
@aws-cdk/aws-ssm Related to AWS Systems Manager bug This issue is a bug. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. effort/medium Medium work item – several days of effort p2 response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

No branches or pull requests

2 participants