From ddf79be176354e8ed26f5ddb31f2dd6205db5022 Mon Sep 17 00:00:00 2001 From: Taehyun Kim Date: Wed, 15 May 2019 23:37:53 +0900 Subject: [PATCH 1/3] fix terraform spot_options key --- upup/pkg/fi/cloudup/awstasks/launchtemplate_target_terraform.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/upup/pkg/fi/cloudup/awstasks/launchtemplate_target_terraform.go b/upup/pkg/fi/cloudup/awstasks/launchtemplate_target_terraform.go index 2d154483c47f1..c65e2f1266e07 100644 --- a/upup/pkg/fi/cloudup/awstasks/launchtemplate_target_terraform.go +++ b/upup/pkg/fi/cloudup/awstasks/launchtemplate_target_terraform.go @@ -75,7 +75,7 @@ type terraformLaunchTemplateMarketOptions struct { // MarketType is the option type MarketType *string `json:"market_type,omitempty"` // SpotOptions are the set of options - SpotOptions []*terraformLaunchTemplateMarketOptionsSpotOptions `json:"options,omitempty"` + SpotOptions []*terraformLaunchTemplateMarketOptionsSpotOptions `json:"spot_options,omitempty"` } type terraformLaunchTemplateBlockDeviceEBS struct { From 5fd53b4d5acd5270bf45476a17b10f804228e330 Mon Sep 17 00:00:00 2001 From: Taehyun Kim Date: Thu, 16 May 2019 01:10:33 +0900 Subject: [PATCH 2/3] spot_options test --- .../awstasks/launchtemplate_target_terraform_test.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/upup/pkg/fi/cloudup/awstasks/launchtemplate_target_terraform_test.go b/upup/pkg/fi/cloudup/awstasks/launchtemplate_target_terraform_test.go index 4731dbcd1d342..d3e61681b33bc 100644 --- a/upup/pkg/fi/cloudup/awstasks/launchtemplate_target_terraform_test.go +++ b/upup/pkg/fi/cloudup/awstasks/launchtemplate_target_terraform_test.go @@ -34,6 +34,7 @@ func TestLaunchTemplateTerraformRender(t *testing.T) { ID: fi.String("test-11"), InstanceMonitoring: fi.Bool(true), InstanceType: fi.String("t2.medium"), + SpotPrice: "0.1", RootVolumeOptimization: fi.Bool(true), RootVolumeIops: fi.Int64(100), RootVolumeSize: fi.Int64(64), @@ -65,7 +66,15 @@ resource "aws_launch_template" "test" { } instance_type = "t2.medium" - key_name = "${aws_key_pair.newkey.id}" + key_name = "${aws_key_pair.newkey.id}" + + instance_market_options = { + market_type = "spot" + + spot_options = { + max_price = "0.1" + } + } network_interfaces = { associate_public_ip_address = true From 0db3bd43e02c8e062a58b331a7929ee161d227e8 Mon Sep 17 00:00:00 2001 From: Taehyun Kim Date: Thu, 16 May 2019 09:04:41 +0900 Subject: [PATCH 3/3] fix test --- .../launchtemplate_target_terraform_test.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/upup/pkg/fi/cloudup/awstasks/launchtemplate_target_terraform_test.go b/upup/pkg/fi/cloudup/awstasks/launchtemplate_target_terraform_test.go index d3e61681b33bc..6dd71ec4f0480 100644 --- a/upup/pkg/fi/cloudup/awstasks/launchtemplate_target_terraform_test.go +++ b/upup/pkg/fi/cloudup/awstasks/launchtemplate_target_terraform_test.go @@ -66,15 +66,15 @@ resource "aws_launch_template" "test" { } instance_type = "t2.medium" - key_name = "${aws_key_pair.newkey.id}" + key_name = "${aws_key_pair.newkey.id}" - instance_market_options = { - market_type = "spot" + instance_market_options = { + market_type = "spot" - spot_options = { - max_price = "0.1" - } - } + spot_options = { + max_price = "0.1" + } + } network_interfaces = { associate_public_ip_address = true