best-lunch-95654
02/14/2022, 3:18 AM# example code
from pulumi import ResourceOptions
import pulumi_aws as aws
aws_vpc = aws.ec2.Vpc(
'my-vpc',
cidr_block = '10.0.0.0/16',
tags = default_tags
)
aws_public_subnet = aws.ec2.Subnet(
resource_name = 'public-subnet-change', # <= Originally a "public-subnet"
vpc_id = aws_vpc.id,
cidr_block = '10.0.1.0/24',
availability_zone = 'ap-northeast-2a',
tags = default_tags,
opts = ResourceOptions(delete_before_replace=True)
)
Do you want to perform this update? yes
Updating (dev):
Type Name Status Info
pulumi😛ulumi:Stack pulumi-demo-dev failed 1 error
+ └─ aws:ec2:Subnet public-subnet-change creating failed 1 error
Diagnostics:
pulumi😛ulumi:Stack (pulumi-demo-dev):
error: update failed
aws:ec2:Subnet (public-subnet-change):
error: 1 error occurred:
* error creating EC2 Subnet: InvalidSubnet.Conflict: The CIDR ‘10.0.1.0/24’ conflicts with another subnet
status code: 400, request id: *billowy-army-68599
02/14/2022, 3:50 AMbest-lunch-95654
02/14/2022, 4:55 AMpulumi up
with the code above,
In the existing code, if the “resource_name” of the subnet is changed and then pulumi up
is performed again, there seems to be a conflict.billowy-army-68599
02/14/2022, 2:07 PMdeleteBeforeReplace
resource option: https://www.pulumi.com/docs/intro/concepts/resources/options/deletebeforereplace/