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

EC2 Instance Tags have two fields in the spec with different semantics #2024

Open
justinmir opened this issue Mar 29, 2024 · 0 comments · May be fixed by #2025
Open

EC2 Instance Tags have two fields in the spec with different semantics #2024

justinmir opened this issue Mar 29, 2024 · 0 comments · May be fixed by #2025
Labels
enhancement New feature or request

Comments

@justinmir
Copy link

EC2 instance tags can currently be specified via TagSpecification and Tags (link).

type InstanceParameters struct {
 	// Tags are used as identification helpers between AWS resources.
	// +optional
	Tags []Tag `json:"tags,omitempty"`

	// The tags to apply to the resources during launch. You can only tag instances
	// and volumes on launch. The specified tags are applied to all instances or
	// volumes that are created during launch. To tag a resource after it has been
	// created, see CreateTags (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateTags.html).
	// +immutable
	// +optional
	TagSpecifications []TagSpecification `json:"tagSpecifications,omitempty"`
}

However, only TagSpecification can be used for tags that must be specified during launch. The EC2 instance controller creates tag specified in Tags in a seperate CreateTags step after the RunInstances call.

How could Crossplane help solve your problem?

Consolidating tags into a single struct Tags would simplify the Spec and make it easier to use. All tags specified in the spec should be applied when the instance is created to ensure that any IAM policies that require tagging are respected.

This would be a backwards incompatible change and any users using TagSpecification would have to migrate to Tags or their tags will be removed on controller upgrade.

However this does make the instance creation a single API call. Currently, if the RunInstances call succeeds but the CreateTags call fails - the instance may be orphaned.

@justinmir justinmir added the enhancement New feature or request label Mar 29, 2024
@justinmir justinmir linked a pull request Mar 29, 2024 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant