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

Remove TagSpecification from the EC2 instance spec #2025

Conversation

justinmir
Copy link

@justinmir justinmir commented Mar 29, 2024

Description of your changes

Instance parameters allows specifying tags in two methods: TagSpecification and Tags. These methods have different semantics - TagSpecification tags will be applied when the instance is created, Tags will be created in a separate CreateTags API call afterwards. All tags required to meet IAM policy must be specified in TagSpecification.

Fixes #2024

I have:

  • Read and followed Crossplane's contribution process.
  • Run make reviewable test to ensure this PR is ready for review.

How has this code been tested

This code has been tested on and deployed in our own fork used in production.

This continues to test the RunInstancesInput generation unit test that was updated to match passing in tags via the Tags field instead of TagSpecification.

@justinmir justinmir force-pushed the tag-at-creation-time-ec2 branch 2 times, most recently from cee6710 to 1584451 Compare March 29, 2024 15:55
Instance parameters allows specifying tags in two methods:
`TagSpecification` and `Tags`. These methods have different semantics -
`TagSpecification` tags will be applied when the instance is created,
`Tags` will be created in a separate `CreateTags` API call afterwards.
All tags required to meet IAM policy must be specified in
`TagSpecification`.

Signed-off-by: justin.miron <[email protected]>
@MisterMX
Copy link
Collaborator

I'm very reluctant about introducing breaking changes to the API. Would it be possible to keep both fields but deprecate one and have both of them being merged together?

@chris-bornmann
Copy link

If values attached to Tags are applied after creation, will this impact organizations with a set of required tags that must be present on creation? My org, and I'm certain many others, requires certain tags on instances and volumes and CreateInstance calls are blocked without those tags specified.

@justinmir justinmir closed this Sep 13, 2024
@justinmir
Copy link
Author

Closing for now as I don't have the time to look at this.

I'm very reluctant about introducing breaking changes to the API. Would it be possible to keep both fields but deprecate one and have both of them being merged together?

I think this is a great solution, keeping backwards compatibility makes sense until a new version of the spec is released.

If values attached to Tags are applied after creation, will this impact organizations with a set of required tags that must be present on creation? My org, and I'm certain many others, requires certain tags on instances and volumes and CreateInstance calls are blocked without those tags specified.

This proposes using a single field that is applied when resources are created (instead of applied in a step after the fact), this still allows the same set of IAM policy that requires tags at the time resources are created. See line 825 in ec2/instance.go for the change from using TagSpecifications to Tags.

But for backwards compatibility its likely best this is changed to merge the two as an input to the RunInstancesInput.

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

Successfully merging this pull request may close these issues.

EC2 Instance Tags have two fields in the spec with different semantics
3 participants