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

Add support for AWS Native #25

Open
tlinhart opened this issue Aug 29, 2024 · 6 comments
Open

Add support for AWS Native #25

tlinhart opened this issue Aug 29, 2024 · 6 comments

Comments

@tlinhart
Copy link
Owner

Add support for tagging resources from AWS Native package.

@druskus20
Copy link

druskus20 commented Sep 13, 2024

This would just be updating the list of allowed resources, how did you generate/make the list?
EDIT: I would also benefit from this - I am writing my own resource transform

@tlinhart
Copy link
Owner Author

@druskus20 the Python package uses some inner details of the Pulumi provider packages to get a list of all resources and the corresponding classes, and introspection to determine if the resource is taggable (supports the tag constructor parameter). The Node.js package then uses the list generated by the Python package (updated via GHA workflow).

Support of AWS Native is twofold:

  • Updating the list of taggable resources, which is quite easy.
  • Merging the autotags with explicitly supplied tags. This is more complicated as AWS Native uses a different format for tags (not a dict but a sequence of dicts with key and value fields).

I’ll delve into it deeper soon.

@druskus20
Copy link

druskus20 commented Sep 13, 2024

I've implemented something like this in Typescript. It is a draft and note that neither my knowledge of typescript, or pulumi is great, so excuse the code quality.
I distinguish between what I call "Object Tags" and "ArrayTags":

//  A: ArrayTags
//
//    [{
//      key: "key",
//      value: "value",
//    }]
//
//  B: ObjectTags
//
//    { key: "value" }
//

I link it here in case it is of any help: https://gist.github.com/druskus20/e3a6cfee05e4c6654b0f70b2cd6989bf

@tlinhart
Copy link
Owner Author

@druskus20 cool, thanks for the link, I'll have a look. I already experimented a bit with the Pulumi AWS Native package but in the end wasn't sure if it really makes sense to integrate it in this library. But I'll definitely take another stab into it.

@tlinhart
Copy link
Owner Author

I digged deeper again and remember where the main problem was – the tests. The library uses transforms for tagging the resources which do not support unit tests using Pulumi mocks. I thus switched to integration tests using LocalStack (which IMHO is better for tests anyway). However, LocalStack doesn't seem to support Cloud Control API which Pulumi AWS Native uses. I'm very reluctant to release anything without a proper test coverage so we'll have to wait I guess.

@druskus20
Copy link

@tlinhart Sounds sensible. Good to know too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants