hashicorp / terraform-cdk

Define infrastructure resources using programming constructs and provision them using HashiCorp Terraform
https://www.terraform.io/cdktf
Mozilla Public License 2.0
4.85k stars 450 forks source link

AWS: In Python Data constructs have tags_input #3024

Closed jej2003 closed 1 year ago

jej2003 commented 1 year ago

Expected Behavior

When using the TaggingAspect at https://developer.hashicorp.com/terraform/cdktf/concepts/aspects tags would only be applied to "Taggable" constructs.

Actual Behavior

Tags are being applied to Data constructs

Steps to Reproduce

  1. Create a simple terraform cdk python project
  2. add the terraform aspect from https://developer.hashicorp.com/terraform/cdktf/concepts/aspects
  3. apply the terraform aspect to the stack

Versions

language: python cdktf-cli: 0.16.1 node: v18.16.0 cdktf: 0.16.3 constructs: 10.2.69 jsii: 1.85.0 terraform: 1.4.2 arch: x64 os: darwin 21.6.0 python: Python 3.10.9 pip: pip 23.0 from /usr/local/lib/python3.10/site-packages/pip (python 3.10) pipenv: pipenv, version 2022.1.8

Providers

┌───────────────┬──────────────────┬─────────┬────────────┬──────────────────────────┬─────────────────┐ │ Provider Name │ Provider Version │ CDKTF │ Constraint │ Package Name │ Package Version │ ├───────────────┼──────────────────┼─────────┼────────────┼──────────────────────────┼─────────────────┤ │ aws │ 4.66.1 │ ^0.16.0 │ │ cdktf-cdktf-provider-aws │ 14.0.4 │ ├───────────────┼──────────────────┼─────────┼────────────┼──────────────────────────┼─────────────────┤ │ tls │ 4.0.4 │ ^0.16.3 │ │ cdktf-cdktf-provider-tls │ 6.0.1 │ └───────────────┴──────────────────┴─────────┴────────────┴──────────────────────────┴─────────────────┘

Gist

No response

Possible Solutions

No response

Workarounds

Update the check in the TaggingAspect to also look for the module and class to filter out Data constructs not x.__class__.__module__.startswith('cdktf_cdktf_provider_aws') and not x.__class__.__name__.startswith('Data')

Anything Else?

No response

References

No response

Help Wanted

Community Note

DanielMSchmidt commented 1 year ago

Hey, we appreciate community PRs for this. Just to clarify, the aspects in the documentation are meant as an example of what is possible and not necessarily as the exact code you need for your project.

jej2003 commented 1 year ago

I tried to reproduce this and have been unable. For now let's close this and I will reopen if I am able to reproduce it.

github-actions[bot] commented 1 year ago

I'm going to lock this issue because it has been closed for 30 days. This helps our maintainers find and focus on the active issues. If you've found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.