Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
391 views
in Technique[技术] by (71.8m points)

amazon web services - Unable to update name of subnet in AWS using terraform module on terraform cloud

I created a subnet with name private-subnet in AWS using terraform with Terraform cloud as backend state store.

Then I changed the name of subnet to private-subnet1 at AWS using AWS console (UI). Also, I make the same changes on my terraform module too.

But now, when I try to deploy other modules, I am getting an error:

Error: error deleting subnet (subnet-xxxxxxxxxxxxxxxxx): timeout while waiting for state to become 'destroyed' (last state: 'pending', timeout: 20m0s)

Error: error creating subnet: InvalidSubnet.Conflict: The CIDR '192.168.1.0/24' conflicts with another subnet

I tried destroying the whole deployment, but that also not worked. Any suggestions?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The proper way to rename a resource is through state mv:

This can be used for simple resource renaming, moving items to and from a module, moving entire modules, and more.

Thus you can try to rename your old subnet in resource into the new one as shown in the link documentation.

Similarly you can try removing the resource using state rm. So you could remove your previous subnet resource, and the import new one as created in console.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...