-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
Feature/fargate support v2 #2559
Changes from all commits
1ee4ecd
927d68c
3693473
ca65a43
8d71878
b48ae4a
efd2510
abbd3e3
83d8406
5c56c41
1da6118
642d870
554f63d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -133,6 +133,11 @@ func resourceAwsEcsService() *schema.Resource { | |
Elem: &schema.Schema{Type: schema.TypeString}, | ||
Set: schema.HashString, | ||
}, | ||
"assign_public_ip": { | ||
Type: schema.TypeBool, | ||
Optional: true, | ||
Default: false, | ||
}, | ||
}, | ||
}, | ||
}, | ||
|
@@ -410,9 +415,14 @@ func flattenEcsNetworkConfigration(nc *ecs.NetworkConfiguration) []interface{} { | |
if nc == nil { | ||
return nil | ||
} | ||
|
||
result := make(map[string]interface{}) | ||
result["security_groups"] = schema.NewSet(schema.HashString, flattenStringList(nc.AwsvpcConfiguration.SecurityGroups)) | ||
result["subnets"] = schema.NewSet(schema.HashString, flattenStringList(nc.AwsvpcConfiguration.Subnets)) | ||
result["assign_public_ip"] = "true" | ||
if *nc.AwsvpcConfiguration.AssignPublicIp == ecs.AssignPublicIpDisabled { | ||
result["assign_public_ip"] = "false" | ||
} | ||
return []interface{}{result} | ||
} | ||
|
||
|
@@ -426,6 +436,13 @@ func expandEcsNetworkConfigration(nc []interface{}) *ecs.NetworkConfiguration { | |
awsVpcConfig.SecurityGroups = expandStringSet(val.(*schema.Set)) | ||
} | ||
awsVpcConfig.Subnets = expandStringSet(raw["subnets"].(*schema.Set)) | ||
if val, ok := raw["assign_public_ip"].(bool); ok { | ||
awsVpcConfig.AssignPublicIp = aws.String(ecs.AssignPublicIpDisabled) | ||
if val { | ||
awsVpcConfig.AssignPublicIp = aws.String(ecs.AssignPublicIpEnabled) | ||
} | ||
} | ||
|
||
return &ecs.NetworkConfiguration{AwsvpcConfiguration: awsVpcConfig} | ||
} | ||
|
||
|
@@ -495,9 +512,8 @@ func resourceAwsEcsServiceUpdate(d *schema.ResourceData, meta interface{}) error | |
} | ||
} | ||
|
||
if d.HasChange("network_configration") { | ||
input.NetworkConfiguration = expandEcsNetworkConfigration(d.Get("network_configuration").([]interface{})) | ||
} | ||
//d.HasChange("network_configration") is not working, so explicity calling method. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure why the the func HadChange is not detecting a change on "network_configuration". Maybe we need to implement equals on the structure? |
||
input.NetworkConfiguration = expandEcsNetworkConfigration(d.Get("network_configuration").([]interface{})) | ||
|
||
// Retry due to IAM & ECS eventual consistency | ||
err := resource.Retry(2*time.Minute, func() *resource.RetryError { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,7 +34,6 @@ func resourceAwsLbListener() *schema.Resource { | |
"load_balancer_arn": { | ||
Type: schema.TypeString, | ||
Required: true, | ||
ForceNew: true, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unrelated change - will fix prior to merge |
||
}, | ||
|
||
"port": { | ||
|
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If
nc.AwsvpcConfiguration.AssignPublicIp
isnil
(its listed as optional in the ECS API documentation), this can cause Terraform to crash. I can fix this (and clean it up a little since it will automatically default to"false"
) prior to merge via: