diff --git a/google/resource_google_service_account.go b/google/resource_google_service_account.go index c5f16ded01e..b865e806ca4 100644 --- a/google/resource_google_service_account.go +++ b/google/resource_google_service_account.go @@ -126,23 +126,28 @@ func resourceGoogleServiceAccountDelete(d *schema.ResourceData, meta interface{} func resourceGoogleServiceAccountUpdate(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - if d.HasChange("display_name") || d.HasChange("description") { - sa, err := config.clientIAM.Projects.ServiceAccounts.Get(d.Id()).Do() - if err != nil { - return fmt.Errorf("Error retrieving service account %q: %s", d.Id(), err) - } - _, err = config.clientIAM.Projects.ServiceAccounts.Update(d.Id(), - &iam.ServiceAccount{ + sa, err := config.clientIAM.Projects.ServiceAccounts.Get(d.Id()).Do() + if err != nil { + return fmt.Errorf("Error retrieving service account %q: %s", d.Id(), err) + } + updateMask := make([]string, 0) + if d.HasChange("description") { + updateMask = append(updateMask, "description") + } + if d.HasChange("display_name") { + updateMask = append(updateMask, "display_name") + } + _, err = config.clientIAM.Projects.ServiceAccounts.Patch(d.Id(), + &iam.PatchServiceAccountRequest{ + UpdateMask: strings.Join(updateMask, ","), + ServiceAccount: &iam.ServiceAccount{ DisplayName: d.Get("display_name").(string), Description: d.Get("description").(string), Etag: sa.Etag, - }).Do() - if err != nil { - return fmt.Errorf("Error updating service account %q: %s", d.Id(), err) - } - // See comment in Create. - time.Sleep(time.Second) - } + }, + }).Do() + // See comment in Create. + time.Sleep(time.Second) return nil } diff --git a/google/resource_google_service_account_test.go b/google/resource_google_service_account_test.go index d44584bbbd4..a6649530a7c 100644 --- a/google/resource_google_service_account_test.go +++ b/google/resource_google_service_account_test.go @@ -17,6 +17,8 @@ func TestAccServiceAccount_basic(t *testing.T) { uniqueId := "" displayName := "Terraform Test" displayName2 := "Terraform Test Update" + desc := "test description" + desc2 := "test description update" project := getTestProjectFromEnv() expectedEmail := fmt.Sprintf("%s@%s.iam.gserviceaccount.com", accountId, project) resource.Test(t, resource.TestCase{ @@ -25,7 +27,7 @@ func TestAccServiceAccount_basic(t *testing.T) { Steps: []resource.TestStep{ // The first step creates a basic service account { - Config: testAccServiceAccountBasic(accountId, displayName), + Config: testAccServiceAccountBasic(accountId, displayName, desc), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr( "google_service_account.acceptance", "project", project), @@ -51,7 +53,7 @@ func TestAccServiceAccount_basic(t *testing.T) { }, // The second step updates the service account { - Config: testAccServiceAccountBasic(accountId, displayName2), + Config: testAccServiceAccountBasic(accountId, displayName2, desc2), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr( "google_service_account.acceptance", "project", project), @@ -90,14 +92,14 @@ func testAccStoreServiceAccountUniqueId(uniqueId *string) resource.TestCheckFunc } } -func testAccServiceAccountBasic(account, name string) string { +func testAccServiceAccountBasic(account, name, desc string) string { return fmt.Sprintf(` resource "google_service_account" "acceptance" { account_id = "%v" display_name = "%v" - description = "foo" + description = "%v" } -`, account, name) +`, account, name, desc) } func testAccServiceAccountWithProject(project, account, name string) string { diff --git a/google/resource_monitoring_uptime_check_config.go b/google/resource_monitoring_uptime_check_config.go index 7c16655b470..3ec900bcce0 100644 --- a/google/resource_monitoring_uptime_check_config.go +++ b/google/resource_monitoring_uptime_check_config.go @@ -125,8 +125,9 @@ func resourceMonitoringUptimeCheckConfig() *schema.Resource { Description: `If true, use HTTPS instead of HTTP to run the check.`, }, "validate_ssl": { - Type: schema.TypeBool, - Optional: true, + Type: schema.TypeBool, + Optional: true, + Description: `Boolean specifying whether to include SSL certificate validation as a part of the Uptime check. Only applies to checks where monitoredResource is set to uptime_url. If useSsl is false, setting validateSsl to true has no effect.`, }, }, },