我有一堆这样设置的模块:
module "by01" {
source = "./modules/app_db"
droplet_name = "by01"
droplet_slug = "s-2vcpu-2gb"
droplet_image = "ubuntu-18-04-x64"
droplet_region = "ams3"
droplet_tags = ["U1804", "TAG_HERE"]
ssh_fingerprint = var.ssh_fingerprint
user_password = var.user_password
pvt_key = var.pvt_key
pub_key = var.pub_key
}
该模块创建一个digitalocean液滴,并设置一些基本DNS和一个浮动IP。当时的想法是我可以在升级OS等时关闭服务器。
我没有想到的是,当我设置一台新服务器时,我想销毁旧服务器。然后我失去了浮动IP和DNS设置。
有没有解决的办法,或者建议采用哪种设置方法?
感谢您的任何建议!
答案 0 :(得分:0)
我要做的是从状态中删除我不想破坏的资源:
$ terraform state rm module.by_old.digitalocean_domain.a_record
$ terraform state rm module.by_old.digitalocean_domain.a_wildcard
$ terraform state rm module.by_old.digitalocean_floating_ip.floating_ip