【发布时间】:2020-11-23 23:28:57
【问题描述】:
我正在尝试在 OCI 上学习 terraform,我在 terraform-code.tf 文件中编写了一个小代码来创建一个块实例,但是当我运行 terraform 计划时出现以下错误。
data "oci_identity_availability_domain" "ad" {
compartment_id = "var.tenancy_ocid"
}
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.
data.oci_identity_availability_domain.ad: Refreshing state...
Error: Get https://identity.var.region.oraclecloud.com/20160918/availabilityDomains?compartmentId=ocid1.tenancy.oc1..aaaaaaaa35fzgotfw445uiswdvjcxnxitafa4scy4dmcuifrvvzkxylqga3q: dial tcp: lookup identity.var.region.oraclecloud.com: no such host
on terraform-code.tf line 46, in data "oci_identity_availability_domain" "ad":
46: data "oci_identity_availability_domain" "ad" {
我尝试从我的 Windows 机器 ping identity.var.region.oraclecloud.com 但没有成功
ping identity.var.region.oraclecloud.com
Ping request could not find host identity.var.region.oraclecloud.com. Please check the name and try again.
我认为这是代理的问题,由于某种原因我无法访问 identity.var.region.oraclecloud.com
我在github上找到了一篇类似的文章:https://github.com/terraform-providers/terraform-provider-oci/issues/960
谁能帮我解决这个问题?
【问题讨论】:
-
您将文字字符串
"var.tenancy_ocid"作为参数传递给compartment_id。您的意思是传递tenancy_ocid变量的值吗? -
嗨蒙哥马利,谢谢您的回复。是的,我后来想通了。实际上问题出在 TF 0.11 上,我们需要使用类似“${var.tenancy_ocid}”这样的变量,这在我使用 0.13.5 的当前版本的 terraform 中已经过时,因此我试图找到完全替换它应该只是 var.tenancy_ocid 而不是“var.tenancy_ocid”
-
变量 var.region 没有被它的值替代。你申报了吗?它应该被类似 us-ashburn-1 的东西取代以形成正确的 url:
https://identity.us-ashburn-1.oraclecloud.com
标签: terraform oracle-cloud-infrastructure