📜  给定的计划文件无法再应用,因为在创建计划后状态被另一个操作更改 - 无论代码示例

📅  最后修改于: 2022-03-11 14:59:05.252000             🧑  作者: Mango

代码示例1
$ cat <<'EOF' >> main.tf
> resource "random_pet" "bucket_suffix" {}
> 
> resource "aws_s3_bucket" "example" {
>   bucket = "example-${random_pet.bucket_suffix.id}"
>   acl    = "private"
> 
>   tags = {
>     ThingToChange = "foo"
>   }
> }
> EOF
$ terraform init
# ...
$ terraform apply
# ...
$ $ sed -i 's/foo/bar/' main.tf
$ terraform plan -out=plan
# ...
$ sed -i 's/bar/baz/' main.tf
$ terraform apply
# ...
$ terraform apply plan
Error: Saved plan is stale

The given plan file can no longer be applied because the state was changed by
another operation after the plan was created.