Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Question - Lookup one app/stack from another #3372

Closed
lobsterdore opened this issue Jul 21, 2019 · 5 comments · Fixed by #3393
Closed

Question - Lookup one app/stack from another #3372

lobsterdore opened this issue Jul 21, 2019 · 5 comments · Fixed by #3393
Labels
@aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud bug This issue is a bug. package/tools Related to AWS CDK Tools or CLI

Comments

@lobsterdore
Copy link

I am using the Python version of the CDK, I have a question about looking up stacks/apps (and whether it's possible or not).

I am creating a few different apps for the various parts of my infra, I would like to create separate apps so I do not need to update foundational components when deploying services, eg. I don't want to deploy the VPC when I deploy a Fargate service.

So far I have three separate apps, one for the VPC, one for the ECS Cluster and one for a Fargate service. To make all this work I need to be able to lookup the VPC stack from both the ECS Cluster and Fargate apps, I will also need to lookup the Cluster app within the Fargate app. Is this currently possible? Or is there a different method for splitting things up?

@lobsterdore lobsterdore added the needs-triage This issue or PR still needs to be triaged. label Jul 21, 2019
@lobsterdore
Copy link
Author

OK I managed to find the from_lookup static method of the vpc class, however when I try perform a lookup using tags like so:

vpc = aws_ec2.Vpc.from_lookup(self, 'Vpc', tags={"environment": "dev", "project": "cdk-example"})

I get the following error when I run cdk ls:

The filter 'environment' is invalid

Are tag based lookups currently working? I am using version 1.1.0 of the CDK.

@RomainMuller
Copy link
Contributor

Hey @lobsterdore - you are correct, we are not correctly emitting filters for the tags when making the EC2 call. Whoops.

If you want this to work right now, you can prefix all tag names with tag: until we have fixed the bug in the CLI.

@RomainMuller RomainMuller added bug This issue is a bug. package/tools Related to AWS CDK Tools or CLI @aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud and removed needs-triage This issue or PR still needs to be triaged. labels Jul 23, 2019
RomainMuller added a commit that referenced this issue Jul 23, 2019
When in the `Filters` parameter of the `DescribeVpcs` call, the tags
need to be encoded as `{ Name: "tag:<name>", Values: ["<value>"] }`, but
the `tag:` prefix was not added by the preparation code.

Fixes #3372
@lobsterdore
Copy link
Author

@RomainMuller OK no worries at all, I will try the tag:fix.

@lobsterdore
Copy link
Author

@RomainMuller is there a way to lookup any Cloudfomation stack and examine it's outputs?

@RomainMuller
Copy link
Contributor

@lobsterdore we don't have any support for this built-in right now, but it should be fairly straight-forward to make a lambda-backed CustomResource that does just this!

eladb pushed a commit that referenced this issue Jul 29, 2019
When in the `Filters` parameter of the `DescribeVpcs` call, the tags
need to be encoded as `{ Name: "tag:<name>", Values: ["<value>"] }`, but
the `tag:` prefix was not added by the preparation code.

Fixes #3372
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud bug This issue is a bug. package/tools Related to AWS CDK Tools or CLI
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants