-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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.) #6791
Comments
According to the docs:
and most of these args ( |
One more comment, to meet the immediate need I'd be in favor of merging PR #4380 even if a different option is chosen in the future (they aren't mutually exclusive.) |
This is the documented behavior of AWS spot instances, rather than a bug in the AWS provider. As a workaround, consider using an auto-scaling group. The autoscaling group can request spot instances, and the launch_configuration will pass tags onto the instance. You don't need to autoscale the autoscaling group; you can specify the pool size manually. The downside to that approach, is that the autoscaling resources do not provide attributes for the resulting instances. |
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 have 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. |
This is a dupe of issue #3263 and PR #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. #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 #3, to avoid changing theaws_instance
object.The text was updated successfully, but these errors were encountered: