mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-16 02:23:39 -06:00
Merge branch 'fix/alb-ecs-integration' of https://github.com/KensoDev/terraform into KensoDev-fix/alb-ecs-integration
This commit is contained in:
commit
aac87bf875
@ -510,7 +510,19 @@ func resourceAwsEcsServiceDelete(d *schema.ResourceData, meta interface{}) error
|
||||
func resourceAwsEcsLoadBalancerHash(v interface{}) int {
|
||||
var buf bytes.Buffer
|
||||
m := v.(map[string]interface{})
|
||||
buf.WriteString(fmt.Sprintf("%s-", m["elb_name"].(string)))
|
||||
|
||||
// There are 2 types of load balancers: ELB/ALB
|
||||
// In case of ELB `elb_name` is expected and for ALB `target_group_arn` is.
|
||||
optionalLoadBalancerParams := []string{"target_group_arn", "elb_name"}
|
||||
|
||||
for i := range optionalLoadBalancerParams {
|
||||
paramName := optionalLoadBalancerParams[i]
|
||||
|
||||
if m[paramName] != nil {
|
||||
buf.WriteString(fmt.Sprintf("%s-", m[paramName].(string)))
|
||||
}
|
||||
}
|
||||
|
||||
buf.WriteString(fmt.Sprintf("%s-", m["container_name"].(string)))
|
||||
buf.WriteString(fmt.Sprintf("%d-", m["container_port"].(int)))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user