Skip to content

Commit

Permalink
instance_interruption_behaviour -> instance_interruption_behavior
Browse files Browse the repository at this point in the history
US Spelling to match the AWS API and the docs.
While this is technically a breaking change this didn't work anyway.
See discussion at hashicorp#1986 (comment)
  • Loading branch information
Tom Elliff committed Oct 27, 2017
1 parent 9d3c251 commit c9694fa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
9 changes: 5 additions & 4 deletions aws/resource_aws_spot_instance_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,12 @@ func resourceAwsSpotInstanceRequest() *schema.Resource {
Optional: true,
ForceNew: true,
}
s["instance_interruption_behaviour"] = &schema.Schema{
s["instance_interruption_behavior"] = &schema.Schema{
Type: schema.TypeString,
Optional: true,
Default: "terminate",
ForceNew: true,
ValidateFunc: validateInstanceInterruptionBehavior,
}
return s
}(),
Expand All @@ -100,7 +101,7 @@ func resourceAwsSpotInstanceRequestCreate(d *schema.ResourceData, meta interface
spotOpts := &ec2.RequestSpotInstancesInput{
SpotPrice: aws.String(d.Get("spot_price").(string)),
Type: aws.String(d.Get("spot_type").(string)),
InstanceInterruptionBehavior: aws.String(d.Get("instance_interruption_behaviour").(string)),
InstanceInterruptionBehavior: aws.String(d.Get("instance_interruption_behavior").(string)),

// Though the AWS API supports creating spot instance requests for multiple
// instances, for TF purposes we fix this to one instance per request.
Expand Down Expand Up @@ -132,7 +133,7 @@ func resourceAwsSpotInstanceRequestCreate(d *schema.ResourceData, meta interface
}

// Placement GroupName can only be specified when instanceInterruptionBehavior is not set to 'stop'
if v, exists := d.GetOkExists("instance_interruption_behaviour"); v == "terminate" || !exists {
if v, exists := d.GetOkExists("instance_interruption_behavior"); v == "terminate" || !exists {
spotOpts.LaunchSpecification.Placement = instanceOpts.SpotPlacement
}

Expand Down Expand Up @@ -239,7 +240,7 @@ func resourceAwsSpotInstanceRequestRead(d *schema.ResourceData, meta interface{}
d.Set("launch_group", request.LaunchGroup)
d.Set("block_duration_minutes", request.BlockDurationMinutes)
d.Set("tags", tagsToMap(request.Tags))
d.Set("instance_interruption_behaviour", request.InstanceInterruptionBehavior)
d.Set("instance_interruption_behavior", request.InstanceInterruptionBehavior)

return nil
}
Expand Down
6 changes: 3 additions & 3 deletions aws/resource_aws_spot_instance_request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func TestAccAWSSpotInstanceRequest_basic(t *testing.T) {
resource.TestCheckResourceAttr(
"aws_spot_instance_request.foo", "spot_request_state", "active"),
resource.TestCheckResourceAttr(
"aws_spot_instance_request.foo", "instance_interruption_behaviour", "terminate"),
"aws_spot_instance_request.foo", "instance_interruption_behavior", "terminate"),
),
},
},
Expand Down Expand Up @@ -379,7 +379,7 @@ func TestAccAWSSpotInstanceRequestStopInterrupt(t *testing.T) {
resource.TestCheckResourceAttr(
"aws_spot_instance_request.foo", "spot_request_state", "active"),
resource.TestCheckResourceAttr(
"aws_spot_instance_request.foo", "instance_interruption_behaviour", "stop"),
"aws_spot_instance_request.foo", "instance_interruption_behavior", "stop"),
),
},
},
Expand Down Expand Up @@ -562,6 +562,6 @@ func testAccAWSSpotInstanceRequestStopInterruptConfig() string {
// and verify termination behavior
wait_for_fulfillment = true
instance_interruption_behaviour = "stop"
instance_interruption_behavior = "stop"
}`)
}

0 comments on commit c9694fa

Please sign in to comment.