diff --git a/google-beta/resource_google_service_account.go b/google-beta/resource_google_service_account.go index e1ab14fad2..2356b4bbcc 100644 --- a/google-beta/resource_google_service_account.go +++ b/google-beta/resource_google_service_account.go @@ -6,6 +6,7 @@ import ( "time" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" "google.golang.org/api/iam/v1" ) @@ -42,8 +43,9 @@ func resourceGoogleServiceAccount() *schema.Resource { Optional: true, }, "description": { - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringLenBetween(0, 256), }, "project": { Type: schema.TypeString, diff --git a/google-beta/resource_google_service_account_test.go b/google-beta/resource_google_service_account_test.go index c1d8941c07..f82b518e7c 100644 --- a/google-beta/resource_google_service_account_test.go +++ b/google-beta/resource_google_service_account_test.go @@ -18,7 +18,7 @@ func TestAccServiceAccount_basic(t *testing.T) { displayName := "Terraform Test" displayName2 := "Terraform Test Update" desc := "test description" - desc2 := "test description update" + desc2 := "" project := getTestProjectFromEnv() expectedEmail := fmt.Sprintf("%s@%s.iam.gserviceaccount.com", accountId, project) resource.Test(t, resource.TestCase{ diff --git a/website/docs/r/google_service_account.html.markdown b/website/docs/r/google_service_account.html.markdown index 3d1b053b8b..75efb5f590 100644 --- a/website/docs/r/google_service_account.html.markdown +++ b/website/docs/r/google_service_account.html.markdown @@ -40,6 +40,7 @@ The following arguments are supported: Can be updated without creating a new resource. * `description` - (Optional) A text description of the service account. + Must be less than or equal to 256 UTF-8 bytes. * `project` - (Optional) The ID of the project that the service account will be created in. Defaults to the provider project configuration.