Terraform-provider-aws: Can't use spot instances with aws_launch_template

Created on 16 Jun 2018  ยท  4Comments  ยท  Source: hashicorp/terraform-provider-aws

_This issue was originally opened by @felipe-vvoosh as hashicorp/terraform#18270. It was migrated here as a result of the provider split. The original body of the issue is below._


There's an issue evaluating valid_until...

If you plan and apply, the launch_template is applied correctly but it breaks the terraform.tfstate file... After that, even a terraform refresh will give this error:

Error: aws_launch_template.test (import id: lt-123456): 1 error(s) occurred:

* import aws_launch_template.test result: lt-123456: aws_launch_template.test: instance_market_options.0.spot_options.0.valid_until: '' expected type 'string', got unconvertible type 'time.Time'
Terraform v0.11.7
+ provider.aws v1.22.0
+ provider.template v1.0.0

AWS INSTANCE MARKET OPTIONS OF LAUNCH_TEMPLATE VERSION:

               "InstanceMarketOptions": {
                    "MarketType": "spot",
                    "SpotOptions": {
                        "MaxPrice": "0.05",
                        "SpotInstanceType": "persistent",
                        "ValidUntil": "2020-11-04T20:44:20.000Z",
                        "InstanceInterruptionBehavior": "stop"
                    }
                }

COMMAND

terraform import aws_launch_template.test lt-123456

TF FILE

resource "aws_launch_template" "test" {

}

DEBUG:

2018/06/16 11:53:53 [ERROR] root: eval: *terraform.EvalRefresh, err: aws_launch_template.test: instance_market_options.0.spot_options.0.valid_until: '' expected type 'string', got unconvertible type 'time.Time'
2018/06/16 11:53:53 [ERROR] root: eval: *terraform.EvalSequence, err: aws_launch_template.test: instance_market_options.0.spot_options.0.valid_until: '' expected type 'string', got unconvertible type 'time.Time'

Error: aws_launch_template.test (import id: lt-123456): 1 error(s) occurred:

* import aws_launch_template.test result: lt-123456: aws_launch_template.test: instance_market_options.0.spot_options.0.valid_until: '' expected type 'string', got unconvertible type 'time.Time'
bug servicec2

All 4 comments

Submitted PR #4952

The fix for this has been merged into master and will release with version 1.25.0 of the AWS provider, likely middle of next week.

This has been released in version 1.25.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

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!

Was this page helpful?
0 / 5 - 0 ratings