-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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 5 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 |
---|---|---|
|
@@ -127,6 +127,11 @@ func resourceAwsEcsService() *schema.Resource { | |
Elem: &schema.Schema{Type: schema.TypeString}, | ||
Set: schema.HashString, | ||
}, | ||
"assign_public_ip": &schema.Schema{ | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Default: "DISABLED", | ||
}, | ||
}, | ||
}, | ||
}, | ||
|
@@ -400,9 +405,12 @@ 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"] = *nc.AwsvpcConfiguration.AssignPublicIp | ||
|
||
return []interface{}{result} | ||
} | ||
|
||
|
@@ -416,6 +424,11 @@ func expandEcsNetworkConfigration(nc []interface{}) *ecs.NetworkConfiguration { | |
awsVpcConfig.SecurityGroups = expandStringSet(val.(*schema.Set)) | ||
} | ||
awsVpcConfig.Subnets = expandStringSet(raw["subnets"].(*schema.Set)) | ||
log.Printf("[DEBUG] assign_public_ip %s", raw["assign_public_ip"]) | ||
if val, ok := raw["assign_public_ip"].(string); ok { | ||
awsVpcConfig.AssignPublicIp = aws.String(val) | ||
log.Printf("[DEBUG] AssingPublicIp %s", awsVpcConfig.AssignPublicIp) | ||
} | ||
return &ecs.NetworkConfiguration{AwsvpcConfiguration: awsVpcConfig} | ||
} | ||
|
||
|
@@ -481,9 +494,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 |
---|---|---|
|
@@ -1261,6 +1261,7 @@ resource "aws_ecs_service" "main" { | |
network_configuration { | ||
security_groups = ["${aws_security_group.allow_all_a.id}", "${aws_security_group.allow_all_b.id}"] | ||
subnets = ["${aws_subnet.main.*.id}"] | ||
assign_public_ip = "ENABLED" | ||
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. I am not sure if this is all I need to do for the test. Seems like I am missing something |
||
} | ||
} | ||
`, rName, rName) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,6 +100,7 @@ Guide](http://docs.aws.amazon.com/AmazonECS/latest/developerguide/cluster-query- | |
`network_configuration` support the following: | ||
* `subnets` - (Required) The subnets associated with the task or service. | ||
* `security_groups` - (Optional) The security groups associated with the task or service. If you do not specify a security group, the default security group for the VPC is used. | ||
* `assign_public_ip` - (Optional) Valid values are "ENABLED" or "DISABLED". Will assign a public IP address to the ENI. | ||
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. Documentation needs to be updated since the switch from string values to boolean values and should also note the default of |
||
For more information, see [Task Networking](http://docs.aws.amazon.com/AmazonECS/latest/developerguidetask-networking.html) | ||
|
||
## Attributes Reference | ||
|
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.
You can remove
&schema.Schema
from this line here.