Skip to content

Commit

Permalink
r/lb+elb: Suppress diff for LBs w/ empty name (#2314)
Browse files Browse the repository at this point in the history
* r/lb+elb: Suppress diff for LBs w/ empty name

* Add explanatory comments
  • Loading branch information
radeksimko authored Nov 16, 2017
1 parent db3c17e commit 33df43f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions aws/resource_aws_elb.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ 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
10 changes: 10 additions & 0 deletions aws/resource_aws_lb.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ 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

0 comments on commit 33df43f

Please sign in to comment.