dev*_*sai 5 terraform terraform-provider-aws
我想将现有的 aws 资源 iam-role“DEVOPS”导入到我的 terraform 管理中。
尽管资源存在,但我收到以下错误 -
错误:无法导入不存在的远程对象
在尝试将现有对象导入到 aws_iam_role.okta_devops_role 时,提供程序检测到不存在具有给定 ID 的对象。只能导入预先存在的对象;检查 ID 是否正确以及它是否与提供者配置的区域或端点关联,或者使用“terraform apply”为此资源创建新的远程对象。
我在 main.tf 中创建了空资源 -> aws_iam_role.devops_role
您应该能够通过执行以下操作来导入现有 IAM 角色资源:
main.tf
如下所示:resource "aws_iam_role" "DEVOPS" {
# stub
}
Run Code Online (Sandbox Code Playgroud)
terraform import aws_iam_role.DEVOPS DEVOPS
Run Code Online (Sandbox Code Playgroud)
terraform show
Run Code Online (Sandbox Code Playgroud)
这是文档的链接。
小智 -4
无法导入未通过 terraform 配置的现有资源。
As terraform do refer to the resource via terraform state file and detects the configuration drift
Still, you can give a try to:-
https://github.com/GoogleCloudPlatform/terraformer#use-with-aws
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
8675 次 |
最近记录: |