hallowed-australia-10473
11/30/2022, 9:47 PMlittle-cartoon-10569
11/30/2022, 10:02 PMhallowed-australia-10473
11/30/2022, 10:07 PMlittle-cartoon-10569
11/30/2022, 10:20 PMhallowed-australia-10473
11/30/2022, 10:22 PMlittle-cartoon-10569
11/30/2022, 11:00 PMhallowed-australia-10473
11/30/2022, 11:01 PMlittle-cartoon-10569
11/30/2022, 11:03 PMhallowed-australia-10473
11/30/2022, 11:04 PMlittle-cartoon-10569
11/30/2022, 11:10 PMhallowed-australia-10473
11/30/2022, 11:10 PMlittle-cartoon-10569
11/30/2022, 11:10 PMhallowed-australia-10473
11/30/2022, 11:11 PMlittle-cartoon-10569
11/30/2022, 11:12 PMhallowed-australia-10473
11/30/2022, 11:13 PMlittle-cartoon-10569
11/30/2022, 11:16 PMhallowed-australia-10473
11/30/2022, 11:20 PMworried-rain-74420
12/01/2022, 12:44 AM--exclude-protected
hallowed-australia-10473
12/01/2022, 12:45 AMlittle-cartoon-10569
12/01/2022, 3:15 AMrunning pulumi up twice on the same code wants to destroy and recreate the bucketWhat does Pulumi say is the reason for this? This happens only because the name of the resource is changing, or some property that triggers replacement is changing.
hallowed-australia-10473
12/02/2022, 1:37 AMView Live: <https://app.pulumi.com/mathuin/pocket-lightning/prod/previews/bc5e1ae0-849f-495b-930c-cf8d63f46bcc>
Type Name Plan Info
pulumi:pulumi:Stack pocket-lightning-prod
└─ digitalocean:index:SpacesBucket pl-bucket 1 error
Diagnostics:
digitalocean:index:SpacesBucket (pl-bucket):
error: unable to replace resource "urn:pulumi:prod::pocket-lightning::digitalocean:index/spacesBucket:SpacesBucket::pl-bucket"
as it is currently marked for protection. To unprotect the resource, remove the `protect` flag from the resource in your Pulumi program and run `pulumi up`
bucket = do.SpacesBucket("pl-bucket", region=region, opts=pulumi.ResourceOptions(protect=True))
region = config.get("region") or "sfo2"
is where region is definedworried-rain-74420
12/03/2022, 11:14 PM--exclude-protected
CLI flag.
If I'm right, try:
pulumi destroy --exclude-protected
hallowed-australia-10473
12/03/2022, 11:14 PMworried-rain-74420
12/03/2022, 11:15 PMhallowed-australia-10473
12/03/2022, 11:15 PMworried-rain-74420
12/03/2022, 11:21 PMhallowed-australia-10473
12/03/2022, 11:22 PM~/g/pocket-lightning ❯❯❯ pulumi up reserved-ips ✚ ✱ ◼
Previewing update (prod)
View Live: <https://app.pulumi.com/mathuin/pocket-lightning/prod/previews/c21bd27c-45f7-40a1-b2d4-191db031c3e3>
Type Name Plan Info
pulumi:pulumi:Stack pocket-lightning-prod
└─ digitalocean:index:SpacesBucket pl-bucket 1 erro
Diagnostics:
digitalocean:index:SpacesBucket (pl-bucket):
error: unable to replace resource "urn:pulumi:prod::pocket-lightning::digitalocean:index/spacesBucket:SpacesBucket::pl-bucket"
as it is currently marked for protection. To unprotect the resource, remove the `protect` flag from the resource in your Pulumi program and run `pulumi up`
worried-rain-74420
12/03/2022, 11:25 PMhallowed-australia-10473
12/03/2022, 11:25 PM~/g/pocket-lightning ❯❯❯ pulumi up --diff ✘ 1 reserved-ips ✚ ✱ ◼
Previewing update (prod)
View Live: <https://app.pulumi.com/mathuin/pocket-lightning/prod/previews/2091b01e-1306-4d95-9f66-cb9b74f5bb86>
pulumi:pulumi:Stack: (same)
[urn=urn:pulumi:prod::pocket-lightning::pulumi:pulumi:Stack::pocket-lightning-prod]
error: unable to replace resource "urn:pulumi:prod::pocket-lightning::digitalocean:index/spacesBucket:SpacesBucket::pl-bucket"
as it is currently marked for protection. To unprotect the resource, remove the `protect` flag from the resource in your Pulumi program and run `pulumi up`
Resources:
2 unchanged
worried-rain-74420
12/03/2022, 11:25 PMpulumi preview
?hallowed-australia-10473
12/03/2022, 11:26 PM~/g/pocket-lightning ❯❯❯ pulumi preview ✘ 255 reserved-ips ✚ ✱ ◼
Previewing update (prod)
View Live: <https://app.pulumi.com/mathuin/pocket-lightning/prod/previews/8e643fe8-b1fb-4a25-9457-5a389f7df783>
Type Name Plan Info
pulumi:pulumi:Stack pocket-lightning-prod
└─ digitalocean:index:SpacesBucket pl-bucket 1 erro
Diagnostics:
digitalocean:index:SpacesBucket (pl-bucket):
error: unable to replace resource "urn:pulumi:prod::pocket-lightning::digitalocean:index/spacesBucket:SpacesBucket::pl-bucket"
as it is currently marked for protection. To unprotect the resource, remove the `protect` flag from the resource in your Pulumi program and run `pulumi up
`worried-rain-74420
12/03/2022, 11:26 PMbucket = do.SpacesBucket("pl-bucket", region=region, opts=pulumi.ResourceOptions(protect=False))
...and running pulumi preview
, just so we can see what Pulumi thinks is supposed to change.hallowed-australia-10473
12/03/2022, 11:29 PM~/g/pocket-lightning ❯❯❯ pulumi preview ✘ 255 reserved-ips ✚ ✱ ◼
Previewing update (prod)
View Live: <https://app.pulumi.com/mathuin/pocket-lightning/prod/previews/b8c217ab-59de-41fb-bd79-97fb66a61b0a>
Type Name Plan
pulumi:pulumi:Stack pocket-lightning-prod
+- ├─ digitalocean:index:SpacesBucket pl-bucket replace
+- ├─ digitalocean:index:ReservedIpAssignment pl-ripa replace
+- └─ digitalocean:index:Droplet pl-droplet replace
Outputs:
~ bucket_name: "pl-bucket-66ee4ad" => "pl-bucket-4077b39"
~ droplet_ip : "138.197.208.46" => output<string>
- reserved_IP: "138.68.36.145"
+ reserved_ip: "138.68.36.145"
Resources:
+-3 to replace
3 unchanged
worried-rain-74420
12/03/2022, 11:29 PMhallowed-australia-10473
12/03/2022, 11:30 PMworried-rain-74420
12/03/2022, 11:31 PMreplace-on-change when the change is the hash seems a little unexpectedYeah, that's a known ergonomic issue with the way we do auto-naming. There's work underway to revamp auto-naming but I'm not sure the current status.
hallowed-australia-10473
12/03/2022, 11:32 PM# create the reserved IP
rip = do.ReservedIp("pl-rip", region=region, opts=pulumi.ResourceOptions(protect=True))
pulumi.export("reserved_ip", rip.ip_address)
# create the domain
domain = do.Domain(
"pl-domain",
name=hostname,
ip_address=rip.ip_address,
opts=pulumi.ResourceOptions(protect=True),
)
pulumi.export("domain_name", domain.name)
worried-rain-74420
12/03/2022, 11:36 PMname
field for your particular resource, then you should try to specify it.
If you're making a one-off resource, then you can hardcode it. If your resource is part of a component, you should try to incorporate the component's name (as provided by the component constructor). You can template the name into a string to do this.
So if this bucket was in a component named MyDOComponent
you might want to name the resource to be MyDOComponent-bucket
vis a vis "{0}-{1}".format(component_name, "bucket")
hallowed-australia-10473
12/03/2022, 11:38 PMworried-rain-74420
12/03/2022, 11:38 PMSpacesBucket
where name
should be replace-on-change
.jack-twilley
, and try to change it's name, you're fundamentally creating a new bucket according to the cloud provider (because you're changing what is expected to be a permanent URI for the bucket).hallowed-australia-10473
12/03/2022, 11:41 PMworried-rain-74420
12/03/2022, 11:42 PMCreditCard
resource, and you wanted to change the CreditCard.cc_number
field, your cloud provider would be within their rights to say "hey man this resource isn't editable! You've got to delete the credit card and make a new one!" It's the same idea with buckets and their names. Or, like "database cluster and engine type".There is a plus to the random tag on the end of the name: it can take a while for a bucket destroy to finish, and I can pulumi up immediately after pulumi destroy because it’ll make a new name for the bucket.Hmm... yeah I'm not sure I have any insight to offer; it sounds like a personal choice. I personally don't want my infrastructure to have nondeterminism -- I want to minimize the randomness as much as possible to make it as reproducible as possible. But if that's something you like for the purpose of performance an convenience, I won't yuck your yum 😸
hallowed-australia-10473
12/03/2022, 11:46 PMworried-rain-74420
12/03/2022, 11:49 PMAnd “replace” isn’t quite what it sounds like for a bucket, or a database — it’s not like the new bucket gets created and the files all get copied over from the old one, right?Correct! It's not a "move", it destroys the old and creates a fresh one. Which is exactly the opposite of what happens when you change a non-
replace-on-change
property. Conceptually, that's more like a "mv", in that it updates the properties of a resource without needing to destroy it and create a new one.hallowed-australia-10473
12/03/2022, 11:50 PMworried-rain-74420
12/03/2022, 11:50 PMhallowed-australia-10473
12/03/2022, 11:51 PMpulumi:pulumi:Stack: (same)
[urn=urn:pulumi:prod::pocket-lightning::pulumi:pulumi:Stack::pocket-lightning-prod]
+-digitalocean:index/spacesBucket:SpacesBucket: (replace) 🔓
[id=pl-bucket-prod]
[urn=urn:pulumi:prod::pocket-lightning::digitalocean:index/spacesBucket:SpacesBucket::pl-bucket]
[provider=urn:pulumi:prod::pocket-lightning::pulumi:providers:digitalocean::default_4_16_0::1533d91c-1447-40ca-ae1c-142b5698f63b]
~ region: "sfo2-zg02" => "sfo2"
What the heck is that on the region?