https://pulumi.com logo
#google-cloud
Title
# google-cloud
b

billions-oxygen-70106

12/22/2020, 2:30 AM
I am getting an error for an imported organization policy resource:
Copy code
error: gcp:organizations/policy:Policy resource 'domain_restricted_sharing' has a problem: ExactlyOne
I'm not sure what the issue is and could use some help. I can get it to work with ListPolicy.All, but not ListPolicy.Allow. Code inside the thread.
Import command:
Copy code
pulumi import gcp:organizations/policy:Policy domain_restricted_sharing 11111111111/constraints/iam.allowedPolicyMemberDomains
Code:
Copy code
package main

import (
	"<http://github.com/pulumi/pulumi-gcp/sdk/v4/go/gcp/organizations|github.com/pulumi/pulumi-gcp/sdk/v4/go/gcp/organizations>"
	"<http://github.com/pulumi/pulumi/sdk/v2/go/pulumi|github.com/pulumi/pulumi/sdk/v2/go/pulumi>"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := organizations.NewPolicy(ctx, "domain_restricted_sharing", &organizations.PolicyArgs{
			Constraint: pulumi.String("constraints/iam.allowedPolicyMemberDomains"),
			ListPolicy: &organizations.PolicyListPolicyArgs{
				Allow: &organizations.PolicyListPolicyAllowArgs{
					// All: pulumi.BoolPtr(true),
					Values: pulumi.StringArray{
						// <https://cloud.google.com/resource-manager/docs/organization-policy/restricting-domains#retrieving_customer_id>
						pulumi.String("C021xxxxx"),
					},
				},
			},
			OrgId: pulumi.String("11111111111"),
		}, pulumi.Protect(true))
		if err != nil {
			return err
		}
}
If I use
All: pulumi.BoolPtr(true),
inside the
ListPolicy
, it is accepted. If I use the Values, it does not.
Also, I imported it with the ListPolicy.Allow.Values, not ListPolicy.Allow.All. I am not trying to make any changes, just have it codified.