Skip to content

Commit

Permalink
Terraform: Skip diffs when managed certs are specified with absolute …
Browse files Browse the repository at this point in the history
…FQDNs

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
drebes authored and modular-magician committed Apr 5, 2019
1 parent f5bcdd3 commit 75ca941
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions google-beta/resource_compute_managed_ssl_certificate.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"log"
"reflect"
"strconv"
"strings"
"time"

"github.com/hashicorp/terraform/helper/schema"
Expand Down Expand Up @@ -58,6 +59,12 @@ func resourceComputeManagedSslCertificate() *schema.Resource {
Type: schema.TypeList,
Required: true,
ForceNew: true,
DiffSuppressFunc: func(k, old, new string, _ *schema.ResourceData) bool {
if k == "managed.0.domains.0" {
return old == strings.TrimRight(new, ".")
}
return old == new
},
MaxItems: 1,
Elem: &schema.Schema{
Type: schema.TypeString,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ resource "google_compute_managed_ssl_certificate" "default" {
name = "test-cert-%{random_suffix}"
managed {
domains = ["sslcert.tf-test.club"]
domains = ["sslcert.tf-test.club."]
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ resource "google_compute_managed_ssl_certificate" "default" {
name = "test-cert"
managed {
domains = ["sslcert.tf-test.club"]
domains = ["sslcert.tf-test.club."]
}
}
Expand Down

0 comments on commit 75ca941

Please sign in to comment.