【发布时间】:2020-03-20 05:43:15
【问题描述】:
使用Auth0 provider 我需要创建一个custom_domain。为了对其进行验证,用户需要使用在此过程中生成的 CNAME 创建 DNS 记录。 verification 资源在 tfstate 文件中如下所示:
"verification": [
{
"methods": [
{
"name": "cname",
"record": "some-random-cname.auth0.com"
}
]
}
],
- 到目前为止,我能够获得一组地图(根据 tfstate 文件),但仍然无法获得
record值
resource "auth0_custom_domain" "main" {
domain = "custom.example.com"
type = "auth0_managed_certs"
verification_method = "txt"
}
locals {
something = flatten(auth0_custom_domain.main.verification[*].methods)
}
output "my-local" {
value = local.something
}
- 输出如下所示:
my-local = [
{
"name" = "cname"
"record" = "some-random-cname.auth0.com"
},
]
- 看来我已经接近获得该记录并将其用作 route53 条目的输入,但我无法获得它,任何帮助将不胜感激。
【问题讨论】:
-
我终于设法做到了,但如果有更好的解决方案,我会保持打开状态:
something = lookup(element(flatten(auth0_custom_domain.main.verification[*].methods), 0), "record") -
您应该考虑将其发布为自我回答,然后看看是否有人能想到更好的方法。不过,这对我来说看起来很合理。
标签: terraform