This message was deleted.
# general
s
This message was deleted.
l
Have a look at the file output by
pulumi stack export --file stack.json
, and see what has the URN urnpulumiorg:some projectpulumipulumiStack:some-project-org . Also have a look at
pulumi preview --diff --show-sames
and look for that URN again.
If you see anything suspicious, post here and we'll help diagnose it.
b
can you share the code you have?
b
Something strange here, but I'm not entirely sure what it means. One of the resources has a different provider ID than the provider that is in the state. I have done
pulumi stack rm --force
between attempts, so perhaps some references are stale?
Copy code
$ pulumi preview --diff --show-sames
Previewing update (org)

  pulumi:pulumi:Stack: (same)
    [urn=urn:pulumi:org::some-project::pulumi:pulumi:Stack::some-project-org]
      gcp:organizations/policy:Policy: (same) 🔒
        [id=1111111111/constraints/compute.requireOsLogin]
        [urn=urn:pulumi:org::some-project::gcp:organizations/policy:Policy::require_os_login]
        [provider: urn:pulumi:org::some-project::pulumi:providers:gcp::default_4_0_0::62add73a-3b08-4c73-a524-947a1ccf5ad2 => urn:pulumi:org::some-project::pulumi:providers:gcp::default::0e24dfe7-f4f6-4756-ab00-fb507493ff3e]
        booleanPolicy: {
            enforced  : true
        }
        constraint   : "constraints/compute.requireOsLogin"
        orgId        : "1111111111"
error: Duplicate resource URN 'urn:pulumi:org::some-project::pulumi:pulumi:Stack::some-project-org'; try giving it a unique name
Resources:
    2 unchanged
This is my current code (from imports), with the org ID anonymized:
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, "require_os_login", &organizations.PolicyArgs{
			BooleanPolicy: &organizations.PolicyBooleanPolicyArgs{
				Enforced: pulumi.Bool(true),
			},
			Constraint: pulumi.String("constraints/compute.requireOsLogin"),
			OrgId:      pulumi.String("1111111111"),
		}, pulumi.Protect(true))
		if err != nil {
			return err
		}
		return nil
	})

	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := organizations.NewPolicy(ctx, "uniform_bucket_access", &organizations.PolicyArgs{
			BooleanPolicy: &organizations.PolicyBooleanPolicyArgs{
				Enforced: pulumi.Bool(true),
			},
			Constraint: pulumi.String("constraints/storage.uniformBucketLevelAccess"),
			OrgId:      pulumi.String("1111111111"),
		}, pulumi.Protect(true))
		if err != nil {
			return err
		}
		return nil
	})

}
l
The different provider thing is a version change. In my experience, that sorts itself out after a couple of `up`s, and isn't anything to worry about.
I know nothing about golang, but the examples in https://github.com/pulumi/examples all use a single
pulumi.Run()
.
Maybe you need to do that?
b
Ahh, that was it, @little-cartoon-10569. Thank you all for your help.
👍 2