Skip to content

Commit

Permalink
issue hashicorp#4449 Add new attribute iam_instance_profile_arn
Browse files Browse the repository at this point in the history
  • Loading branch information
saravanan30erd committed May 11, 2018
1 parent 38d79b8 commit 5c23665
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
17 changes: 16 additions & 1 deletion aws/resource_aws_spot_fleet_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,11 @@ func resourceAwsSpotFleetRequest() *schema.Resource {
ForceNew: true,
Optional: true,
},
"iam_instance_profile_arn": {
Type: schema.TypeString,
ForceNew: true,
Optional: true,
},
"ami": {
Type: schema.TypeString,
Required: true,
Expand Down Expand Up @@ -371,6 +376,12 @@ func buildSpotFleetLaunchSpecification(d map[string]interface{}, meta interface{
}

if v, ok := d["iam_instance_profile"]; ok {
opts.IamInstanceProfile = &ec2.IamInstanceProfileSpecification{
Name: aws.String(v.(string)),
}
}

if v, ok := d["iam_instance_profile_arn"]; ok {
opts.IamInstanceProfile = &ec2.IamInstanceProfileSpecification{
Arn: aws.String(v.(string)),
}
Expand Down Expand Up @@ -935,8 +946,12 @@ func launchSpecToMap(l *ec2.SpotFleetLaunchSpecification, rootDevName *string) m
m["monitoring"] = aws.BoolValue(l.Monitoring.Enabled)
}

if l.IamInstanceProfile != nil && l.IamInstanceProfile.Name != nil {
m["iam_instance_profile"] = aws.StringValue(l.IamInstanceProfile.Name)
}

if l.IamInstanceProfile != nil && l.IamInstanceProfile.Arn != nil {
m["iam_instance_profile"] = aws.StringValue(l.IamInstanceProfile.Arn)
m["iam_instance_profile_arn"] = aws.StringValue(l.IamInstanceProfile.Arn)
}

if l.UserData != nil {
Expand Down
4 changes: 2 additions & 2 deletions website/docs/r/spot_fleet_request.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ resource "aws_spot_fleet_request" "cheap_compute" {
ami = "ami-1234"
spot_price = "2.793"
placement_tenancy = "dedicated"
iam_instance_profile = "arn:aws:iam::12345678:instance-profile/webserver-role"
iam_instance_profile_arn = "arn:aws:iam::12345678:instance-profile/webserver-role"
}
launch_specification {
instance_type = "m4.4xlarge"
ami = "ami-5678"
key_name = "my-key"
spot_price = "1.117"
iam_instance_profile = "arn:aws:iam::12345678:instance-profile/webserver-role"
iam_instance_profile_arn = "arn:aws:iam::12345678:instance-profile/webserver-role"
availability_zone = "us-west-1a"
subnet_id = "subnet-1234"
weighted_capacity = 35
Expand Down

0 comments on commit 5c23665

Please sign in to comment.