Skip to content

Commit

Permalink
Merge pull request #2939 from terraform-providers/b-elb-name-empty
Browse files Browse the repository at this point in the history
resource/aws_lb+aws_elb: Fix regression with undefined 'name'
  • Loading branch information
radeksimko authored Jan 11, 2018
2 parents 9f03e1d + dcf9012 commit b2c14ca
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 20 deletions.
10 changes: 0 additions & 10 deletions aws/resource_aws_elb.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,6 @@ func resourceAwsElb() *schema.Resource {
ForceNew: true,
ConflictsWith: []string{"name_prefix"},
ValidateFunc: validateElbName,
// This is to work around an unexpected schema behaviour returning diff
// for an empty field when it has a pre-computed value from previous run
// (e.g. from name_prefix)
// TODO: Revisit after we find the real root cause
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
if new == "" {
return true
}
return false
},
},
"name_prefix": &schema.Schema{
Type: schema.TypeString,
Expand Down
5 changes: 5 additions & 0 deletions aws/resource_aws_elb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1231,6 +1231,11 @@ resource "aws_elb" "foo" {
lb_protocol = "http"
}
}
# See https://github.com/terraform-providers/terraform-provider-aws/issues/2498
output "lb_name" {
value = "${aws_elb.foo.name}"
}
`

const testAccAWSELBConfig_AvailabilityZonesUpdate = `
Expand Down
10 changes: 0 additions & 10 deletions aws/resource_aws_lb.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,6 @@ func resourceAwsLb() *schema.Resource {
ForceNew: true,
ConflictsWith: []string{"name_prefix"},
ValidateFunc: validateElbName,
// This is to work around an unexpected schema behaviour returning diff
// for an empty field when it has a pre-computed value from previous run
// (e.g. from name_prefix)
// TODO: Revisit after we find the real root cause
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
if new == "" {
return true
}
return false
},
},

"name_prefix": {
Expand Down
5 changes: 5 additions & 0 deletions aws/resource_aws_lb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1218,6 +1218,11 @@ resource "aws_lb" "lb_test" {
}
}
# See https://github.com/terraform-providers/terraform-provider-aws/issues/2498
output "lb_name" {
value = "${aws_lb.lb_test.name}"
}
variable "subnets" {
default = ["10.0.1.0/24", "10.0.2.0/24"]
type = "list"
Expand Down

0 comments on commit b2c14ca

Please sign in to comment.