为什么 Terraform 导入无提示地失败?
Why is Terraform import silently failing?
我正在尝试导入 AWS RDS 数据库实例。导入报告成功,但我的状态没有变化
我使用 Terraform 0.14.1 开始了这个过程,并且在导入时遇到了详细的错误 (Error: Cannot import non-existent remote object
)。在我更新到 Terraform 0.15.1(通过 MacOS 上的自制程序)后,导入现在报告成功,但实际上并没有更新状态。此外,我可以“成功地”运行 一次又一次地导入而不会出错,强调导入实际上并没有更新状态。
这是 Terraform 中的错误,还是我的流程或配置有问题?
$ terraform import aws_db_instance.fuse-db <ID>
aws_db_instance.fuse-db: Importing from ID "<ID>"...
aws_db_instance.fuse-db: Import prepared!
Prepared aws_db_instance for import
aws_db_instance.fuse-db: Refreshing state... [id=<ID>]
Import successful!
The resources that were imported are shown above. These resources are now in
your Terraform state and will henceforth be managed by Terraform.
$ terraform state show aws_db_instance.fuse-db
No instance found for the given address!
This command requires that the address references one specific instance.
To view the available instances, use "terraform state list". Please modify
the address to reference a specific instance.
$ terraform -v
Terraform v0.15.1
on darwin_amd64
+ provider registry.terraform.io/hashicorp/aws v3.38.0
我能够使用在 AWS 中称为 'DB identifier' 的 aws_db_instance.id
值成功导入资源。我一直在尝试使用 aws_db_instance.resource_id
值,这是我导入的大多数其他资源使用的值类型。
我正在尝试导入 AWS RDS 数据库实例。导入报告成功,但我的状态没有变化
我使用 Terraform 0.14.1 开始了这个过程,并且在导入时遇到了详细的错误 (Error: Cannot import non-existent remote object
)。在我更新到 Terraform 0.15.1(通过 MacOS 上的自制程序)后,导入现在报告成功,但实际上并没有更新状态。此外,我可以“成功地”运行 一次又一次地导入而不会出错,强调导入实际上并没有更新状态。
这是 Terraform 中的错误,还是我的流程或配置有问题?
$ terraform import aws_db_instance.fuse-db <ID>
aws_db_instance.fuse-db: Importing from ID "<ID>"...
aws_db_instance.fuse-db: Import prepared!
Prepared aws_db_instance for import
aws_db_instance.fuse-db: Refreshing state... [id=<ID>]
Import successful!
The resources that were imported are shown above. These resources are now in
your Terraform state and will henceforth be managed by Terraform.
$ terraform state show aws_db_instance.fuse-db
No instance found for the given address!
This command requires that the address references one specific instance.
To view the available instances, use "terraform state list". Please modify
the address to reference a specific instance.
$ terraform -v
Terraform v0.15.1
on darwin_amd64
+ provider registry.terraform.io/hashicorp/aws v3.38.0
我能够使用在 AWS 中称为 'DB identifier' 的 aws_db_instance.id
值成功导入资源。我一直在尝试使用 aws_db_instance.resource_id
值,这是我导入的大多数其他资源使用的值类型。