Open ciaransweet opened 3 years ago
I think this needs an adjusted contextProvider for the fromLookup for parameters. The value that can be referenced from the fromAttributes ones can only work in the same region because they use a CfnDynamicReference or a CfnParameter which do not support cross region.
@ciaranevans is this still relevant? The first argument to from_string_parameter_attributes
is the scope
which you could provide the region in.
stack = Stack(app, 'MyStack', env=Environment(region='us-east-1' ));
params = StringParameter.from_string_parameter_attributes(stack, "my-param", parameter_name="/my/path")
@corymhall - firstly, probably not relevant for me... I raised it 3 years ago 😅 however, it has 44 other folks that reacted, so I imagine so.
Also, I don't think importing a stack just for the sake of being able to use its region is best, like my original post asked, it would be ideal if it just behaved the same as buckets. Those didn't require the separate import of a stack.
But, full disclosure, I don't touch CDK anymore 😭 so things have probably changed a lot.
This issue has received a significant amount of attention so we are automatically upgrading its priority. A member of the community will see the re-prioritization and provide an update on the issue.
I'd like to be able to get references/retrieve parameters via their
path
andregion
. I can currently do similar to this with S3 Buckets with: Bucket.from_bucket_attributes.However when I look at a similar method for SSM parameters StringParameter.from_string_parameter_attributes I am unable to pass
region
as a argument. I am also limited to specifying the one name. I would like a similar implementation to Boto3s get_parameters_by_path which enables a wildcard approach to finding parameters.Ideally I would like to do something like:
Use Case
So my scenario is:
An external project can create n randomly named buckets in a region - it stores the names of these buckets under deterministic keys in Parameter Store eg (/project/stage/bucket-name-1)
My stack (in a different region) - wants to import those buckets (use them as references), so I currently do this by using Boto3 and getting the parameters under
/project/stage/
- Doing this gives me the randomly generated bucket names. Then I can uses3.Bucket.from_bucket_attributes
with the bucket name and the region the bucket was created in, to import those buckets as references into my stack.This is working, but when I do another deploy (without changing anything) - these references are totally different objects (but still point to the same buckets) so I always have changes according to CDK.
I'd like my proposed features implemented so that I can import SSM parameters in a CDK-style manner, so that my further deploys (with no changes) indicate nothing is different.
Other
I'm unsure if this is just the CDK which needs this implemented or CloudFormation itself. I see that CfnParameterProps makes no mention of
region
either.Happy to raise this elsewhere if it belongs in a better place!
This is a :rocket: Feature Request