小编Jat*_*hal的帖子

如何在 terraform 的 file() 中传递变量

需要使用 terraform 创建 cloudfront 公钥,这里公钥是根据环境单独的,并以 {env_name}.pem 形式存储在目录名称 public-key-cf 中。env_name 可以是 dev、stage、prod。

为了实现这一点,使用了以下 terraform 块:

resource "aws_cloudfront_public_key" "documents-signing-key" {
  name        = "cf-public-key"
  comment     = "Public Key"
  encoded_key = file("${path.module}/public-key-cf/"${var.environment}".pem)"
}
Run Code Online (Sandbox Code Playgroud)

我收到错误如下:

This character is not used within the language.
Run Code Online (Sandbox Code Playgroud)

如何解决这个问题?

谢谢。

variables file terraform terraform-provider-aws

-2
推荐指数
1
解决办法
2457
查看次数