简体   繁体   English

Terraform 导入 - 查找资源 ID

[英]Terraform Import - finding the resource id

I am trying to import an aws_db_subnet_group .我正在尝试导入aws_db_subnet_group The terraform docs are very limited in explaining how you are supposed to go about doing this other than providing the one line to execute除了提供要执行的一行之外, terraform 文档在解释您应该如何执行此操作方面非常有限

terraform import aws_db_subnet_group.default <subnet-group-id>

I am searching the AWS console and I cannot find this <subnet-group-id> anywhere.我正在搜索 AWS 控制台,但在任何地方都找不到此<subnet-group-id> I've ran into this issue a few times now, hunting through the AWS console for a specific resource's ID so that I can import it.我现在遇到过几次这个问题,通过 AWS 控制台寻找特定资源的 ID,以便我可以导入它。 Does anyone know where/how to go about doing this in general?有谁知道一般在哪里/如何去做? And for my current problem, how to find it for an ElastiCache Subnet Group ID?对于我当前的问题,如何为 ElastiCache 子网组 ID 找到它?

I referred to the aws elasticache documentation and tried running describe-cache-subnet-groups我参考了aws elasticache文档并尝试运行describe-cache-subnet-groups

aws elasticache describe-cache-subnet-groups --cache-subnet-group-name <name>

But this did not give me any ID related to the cache subnet group that I could use for the import但这并没有给我任何与我可以用于导入的缓存子网组相关的 ID

First of all, DB subnet groups and ElastiCache subnet groups are two different things.首先,DB 子网组和 ElastiCache 子网组是两个不同的东西。 You don't use your db subnet groups for your ElasticCache instances.您不将 db 子网组用于 ElasticCache 实例。

From the documentation it seems that both db subnet groups and cache subnet groups are imported by their names, not IDs.从文档看来,db 子网组和缓存子网组都是按名称而不是 ID 导入的。 You can find your subnet group names in your console:您可以在控制台中找到您的子网组名称:

ElastiCache dashboard - Subnet Groups on the sidebar - Name column ElastiCache仪表板 - 侧边栏上的Subnet Groups - Name

or RDS dashboard - Subnet Groups on the sidebar - Name columnRDS仪表板 - 侧边栏上的Subnet Groups - Name

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM