Skip to content
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

Adding minimum to support host_resource_group_arn #15785

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions aws/data_source_aws_launch_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,10 @@ func dataSourceAwsLaunchTemplate() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"host_resource_group_arn": {
Type: schema.TypeString,
Computed: true,
},
"spread_domain": {
Type: schema.TypeString,
Computed: true,
Expand Down
25 changes: 18 additions & 7 deletions aws/resource_aws_launch_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,12 @@ func resourceAwsLaunchTemplate() *schema.Resource {
Type: schema.TypeString,
Optional: true,
},
"host_resource_group_arn": {
Type: schema.TypeString,
Optional: true,
ConflictsWith: []string{"placement.0.host_id"},
ValidateFunc: validateArn,
},
"spread_domain": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -1183,13 +1189,14 @@ func getPlacement(p *ec2.LaunchTemplatePlacement) []interface{} {
var s []interface{}
if p != nil {
s = append(s, map[string]interface{}{
"affinity": aws.StringValue(p.Affinity),
"availability_zone": aws.StringValue(p.AvailabilityZone),
"group_name": aws.StringValue(p.GroupName),
"host_id": aws.StringValue(p.HostId),
"spread_domain": aws.StringValue(p.SpreadDomain),
"tenancy": aws.StringValue(p.Tenancy),
"partition_number": aws.Int64Value(p.PartitionNumber),
"affinity": aws.StringValue(p.Affinity),
"availability_zone": aws.StringValue(p.AvailabilityZone),
"group_name": aws.StringValue(p.GroupName),
"host_id": aws.StringValue(p.HostId),
"host_resource_group_arn": aws.StringValue(p.HostResourceGroupArn),
"spread_domain": aws.StringValue(p.SpreadDomain),
"tenancy": aws.StringValue(p.Tenancy),
"partition_number": aws.Int64Value(p.PartitionNumber),
})
}
return s
Expand Down Expand Up @@ -1759,6 +1766,10 @@ func readPlacementFromConfig(p map[string]interface{}) *ec2.LaunchTemplatePlacem
placement.HostId = aws.String(v)
}

if v, ok := p["host_resource_group_arn"].(string); ok && v != "" {
placement.HostResourceGroupArn = aws.String(v)
}

if v, ok := p["spread_domain"].(string); ok && v != "" {
placement.SpreadDomain = aws.String(v)
}
Expand Down
1 change: 1 addition & 0 deletions website/docs/r/launch_template.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ The `placement` block supports the following:
* `availability_zone` - The Availability Zone for the instance.
* `group_name` - The name of the placement group for the instance.
* `host_id` - The ID of the Dedicated Host for the instance.
* `host_resource_group_arn` - The ARN of the Host Resource Group in which to launch instances.
* `spread_domain` - Reserved for future use.
* `tenancy` - The tenancy of the instance (if the instance is running in a VPC). Can be `default`, `dedicated`, or `host`.
* `partition_number` - The number of the partition the instance should launch in. Valid only if the placement group strategy is set to partition.
Expand Down