From d52d3d922bbe366739da879af2425ae3a48905ab Mon Sep 17 00:00:00 2001 From: Sam Levenick Date: Wed, 20 Nov 2019 15:48:33 -0800 Subject: [PATCH] Validate on deleted members --- .../data_sources/data_source_google_iam_policy.go.erb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/third_party/terraform/data_sources/data_source_google_iam_policy.go.erb b/third_party/terraform/data_sources/data_source_google_iam_policy.go.erb index f67d4a41ad43..b36eaf27277b 100644 --- a/third_party/terraform/data_sources/data_source_google_iam_policy.go.erb +++ b/third_party/terraform/data_sources/data_source_google_iam_policy.go.erb @@ -3,11 +3,13 @@ package google import ( "encoding/json" + "regexp" "sort" "strconv" "github.com/hashicorp/terraform-plugin-sdk/helper/hashcode" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" "google.golang.org/api/cloudresourcemanager/v1" ) @@ -39,7 +41,10 @@ func dataSourceGoogleIamPolicy() *schema.Resource { "members": { Type: schema.TypeSet, Required: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Elem: &schema.Schema{ + Type: schema.TypeString, + ValidateFunc: validation.StringDoesNotMatch(regexp.MustCompile("^deleted:"), "Terraform does not support deleted IAM members"), + }, Set: schema.HashString, }, <% unless version == 'ga' -%>