-
Notifications
You must be signed in to change notification settings - Fork 20
[FR] x-vpc: Allow Lookup.Identifier usage #798
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
Comments
Hello :) x-vpc:
Lookup:
VpcId:
Tags:
Identifier: vpc-xxx Should work and is the recommended way to use Lookup (finds items via tags api). The tags you select here for the VPC in particular though must resolve to a single resource. For Subnets, the tags can match up to multiple subnets of course. There is a way to give the ARN indeed of the resource you are looking for but that's not the recommended way. Let me dig it though. |
Thank you, however that syntax is not working.
Also tried:
Well, at least I finally tagged the network resources! |
Hmm okay. Let me investigate but, weird...
…On Tue, Mar 25, 2025, 13:13 jakub-qg ***@***.***> wrote:
Thank you, however that syntax is not working.
x-vpc:
Lookup:
VpcId:
Tags:
Identifier: vpc-030xxxxxxxxxx
Also tried:
Tags:
- Identifier: vpc-030xxxxxxxxxx
LookupError: ('No resources were found with the provided tags and information', None, 'ec2:vpc')
Well, at least I finally tagged the network resources!
—
Reply to this email directly, view it on GitHub
<#798 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJNZNWB3MWEXKUA7KU5ARL2WFB5TAVCNFSM6AAAAABZXIWGKGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONJRGIZDANZSGU>
.
You are receiving this because you were assigned.Message ID:
***@***.***>
[image: jakub-qg]*jakub-qg* left a comment (compose-x/ecs_composex#798)
<#798 (comment)>
Thank you, however that syntax is not working.
x-vpc:
Lookup:
VpcId:
Tags:
Identifier: vpc-030xxxxxxxxxx
Also tried:
Tags:
- Identifier: vpc-030xxxxxxxxxx
LookupError: ('No resources were found with the provided tags and information', None, 'ec2:vpc')
Well, at least I finally tagged the network resources!
—
Reply to this email directly, view it on GitHub
<#798 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJNZNWB3MWEXKUA7KU5ARL2WFB5TAVCNFSM6AAAAABZXIWGKGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONJRGIZDANZSGU>
.
You are receiving this because you were assigned.Message ID:
***@***.***>
|
Well so, if your network resources are not tagged, this explains this error message, there is nothing to find :D |
To clarify, the |
Resources in AWS have an ID that is regional, but the real identifier that works all the time is the ARN. Therefore, in the code you can pass the ARN directly. But not the shorthand ID which is regional. I haven't yet had the case of multi-region use-cases but ARNs just remove the guessing altogether. "Name" is not a thing (not consistently for all resources anyways, and I always recommend not to give things a name, let CFN generate it), there is a massively common pattern used by AWS customers to use the tag key So, in Lookup, if you did x-vpc:
Lookup:
VpcId:
Arn: arn:aws:ec2:region::account/vpc/vpc-id # on top of my head Then that would work, as you are saying "Use the ARN, don't bother looking up (See https://github.com/compose-x/ecs_composex/blob/main/ecs_composex/compose/x_resources/__init__.py#L249) Otherwise, yes, your resources, network or otherwise, must be tagged appropriately for this to work. I will check in the docs, as this has had a few evolution and however the docs contain the JSON schemas of what is expected to be set by the user, this does not yet render into the most human friendly docs to go through. I hope this sheds some light on this. I will spin a VPC up etc. and give you a working example of what works with the latest version of the code. |
I wasn't able to get the lookup syntax working with just giving it an Arn, unfortunately, since that would be my preference. But I did get this tag syntax working: x-vpc:
Lookup:
VpcId:
Tags:
Name: "Customer Dashboard"
env: prod
PublicSubnets:
Tags:
"aws-cdk:subnet-type": Public
env: prod
AppSubnets:
Tags:
"aws-cdk:subnet-type": Private
env: prod
StorageSubnets:
Tags:
"aws-cdk:subnet-type": Private
env: prod Some quirk in the tag API required that I include both tags for the VPC even though only one VPC has that particular Name tag. Not a bug in this tool, but apparently in AWS. Throwing in my +1 for being able to reference explicitly by a VPC ID! |
Is your feature request related to a problem? Please describe.
Make the syntax work:
Output (if there are no VPC with tags in whole AWS acct):
Output (if there are two tagged VPCs but using "Identifier"):
Not sure if this is a bug or feature. Docs are unclear.
Lookups docs suggest this should be possible:
x-vpc docs nor test cases ever mention this field
Reasoning:
Describe the solution you'd like
Allow ID/ARN lookup
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: