-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
How to Handle AWS Spot Instance args (tags, etc.) #174
Comments
AWS now natively supports instance tags for spot fleets/requests: https://aws.amazon.com/about-aws/whats-new/2017/07/tag-your-spot-fleet-ec2-instances/ |
I have one spot instance created by one spot instance request, and I'd like name and tags to work like they do on |
Unfortunately it's still not directly possible to tag spot instances themselves when they start as a spot instance request. The AWS User Guide explains this a bit further and mentions you have to manually tag the instances after they are created. It should be technically possible for Terraform to find the instances created by the spot request and then tag them after waiting for fulfilment but I'm not 100% sure on how to best define how this happens other than just have it happen implicitly if the spot instance request is tagged and |
The issue has been noted in #32 (and others) and a solution discussed in #9061 (comment). |
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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
This issue was originally opened by @johnnyshields as hashicorp/terraform#6791. It was migrated here as part of the provider split. The original body of the issue is below.
This is a dupe of issue #32 and PR hashicorp/terraform#4380. I am raising a new issue because I'd like to revisit the problem and agree on an approach with the Terraform team.
The Problem
spot_instance_request
resource. Aaws_spot_instance_request
is not an "instance" itself, rather it is a request to Amazon to generate an instance.tags
onaws_spot_instance_request
, however, the tags are not forwarded by AWS to the actual instance when the request in fulfilled (see: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-requests.html)Possible Solutions
tags
onaws_spot_instance_request
to mean the tags to set on the instance created when the spot request is fulfilled. This is what PR provider/aws: tag the spot instance. terraform#4380 does.instance_args
node to theaws_spot_instance_request
resource which allows various args liketags
to be set by Terraform on the instance after fulfillment.aws_instance
to have new fieldsis_spot_instance
,spot_price
,spot_type
etc. If these are set, then Terraform uses a spot instance request workflow to initialize the instance. This approach will require the most effort but is ultimately the most friendly / least surprising to the developer in my opinion--many AWS-related libraries use this abstraction pattern.aws_spot_instance
which behaves as described in config: require blocks for upstream dependencies terraform#3, to avoid changing theaws_instance
object.The text was updated successfully, but these errors were encountered: