diff --git a/google/resource_appengine_firewall_rule_generated_test.go b/google/resource_appengine_firewall_rule_generated_test.go index 4bb0ee6eeac..af45f401b7a 100644 --- a/google/resource_appengine_firewall_rule_generated_test.go +++ b/google/resource_appengine_firewall_rule_generated_test.go @@ -16,6 +16,7 @@ package google import ( "fmt" + "strings" "testing" "github.com/hashicorp/terraform/helper/acctest" @@ -71,10 +72,13 @@ resource "google_appengine_firewall_rule" "rule" { } func testAccCheckAppengineFirewallRuleDestroy(s *terraform.State) error { - for _, rs := range s.RootModule().Resources { + for name, rs := range s.RootModule().Resources { if rs.Type != "google_appengine_firewall_rule" { continue } + if strings.HasPrefix(name, "data.") { + continue + } config := testAccProvider.Meta().(*Config) diff --git a/google/resource_compute_image_generated_test.go b/google/resource_compute_image_generated_test.go index 7c66e914fe8..eb567d3e3c4 100644 --- a/google/resource_compute_image_generated_test.go +++ b/google/resource_compute_image_generated_test.go @@ -27,13 +27,17 @@ import ( func TestAccComputeImage_imageBasicExample(t *testing.T) { t.Parallel() + context := map[string]interface{}{ + "random_suffix": acctest.RandString(10), + } + resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckComputeImageDestroy, Steps: []resource.TestStep{ { - Config: testAccComputeImage_imageBasicExample(acctest.RandString(10)), + Config: testAccComputeImage_imageBasicExample(context), }, { ResourceName: "google_compute_image.example", @@ -45,17 +49,16 @@ func TestAccComputeImage_imageBasicExample(t *testing.T) { }) } -func testAccComputeImage_imageBasicExample(val string) string { - return fmt.Sprintf(` +func testAccComputeImage_imageBasicExample(context map[string]interface{}) string { + return Nprintf(` resource "google_compute_image" "example" { - name = "example-image-%s" + name = "example-image-%{random_suffix}" raw_disk { source = "https://storage.googleapis.com/bosh-cpi-artifacts/bosh-stemcell-3262.4-google-kvm-ubuntu-trusty-go_agent-raw.tar.gz" } } -`, val, - ) +`, context) } func testAccCheckComputeImageDestroy(s *terraform.State) error { diff --git a/google/resource_monitoring_uptime_check_config.go b/google/resource_monitoring_uptime_check_config.go index 25db4d15ce7..28eb8bea486 100644 --- a/google/resource_monitoring_uptime_check_config.go +++ b/google/resource_monitoring_uptime_check_config.go @@ -19,6 +19,7 @@ import ( "log" "reflect" "strconv" + "strings" "time" "github.com/hashicorp/terraform/helper/schema" @@ -461,6 +462,53 @@ func resourceMonitoringUptimeCheckConfigUpdate(d *schema.ResourceData, meta inte } log.Printf("[DEBUG] Updating UptimeCheckConfig %q: %#v", d.Id(), obj) + updateMask := []string{} + + if d.HasChange("display_name") { + updateMask = append(updateMask, "displayName") + } + + if d.HasChange("timeout") { + updateMask = append(updateMask, "timeout") + } + + if d.HasChange("content_matchers") { + updateMask = append(updateMask, "contentMatchers") + } + + if d.HasChange("selected_regions") { + updateMask = append(updateMask, "selectedRegions") + } + + if d.HasChange("is_internal") { + updateMask = append(updateMask, "isInternal") + } + + if d.HasChange("internal_checkers") { + updateMask = append(updateMask, "internalCheckers") + } + + if d.HasChange("http_check") { + updateMask = append(updateMask, "httpCheck") + } + + if d.HasChange("tcp_check") { + updateMask = append(updateMask, "tcpCheck") + } + + if d.HasChange("resource_group") { + updateMask = append(updateMask, "resourceGroup") + } + + if d.HasChange("monitored_resource") { + updateMask = append(updateMask, "monitoredResource") + } + // updateMask is a URL parameter but not present in the schema, so replaceVars + // won't set it + url, err = addQueryParams(url, map[string]string{"updateMask": strings.Join(updateMask, ",")}) + if err != nil { + return err + } _, err = sendRequestWithTimeout(config, "PATCH", url, obj, d.Timeout(schema.TimeoutUpdate)) if err != nil {