小编Bij*_*iju的帖子

如何传递 Terraform S3 后端资源的变量?

terraform {
  backend "s3" {
    bucket = "mybucket"
    key    = "path/to/my/key"
    region = "us-east-1"
  }
}
Run Code Online (Sandbox Code Playgroud)

是否无法通过变量文件为上面的存储桶和键提供值?

因为当我尝试这样做时:

terraform {
  backend "s3" {
    bucket = var.bucket
    key    = var.key
  }
}
Run Code Online (Sandbox Code Playgroud)

,我收到以下错误:

terraform {
  backend "s3" {
    bucket = "mybucket"
    key    = "path/to/my/key"
    region = "us-east-1"
  }
}
Run Code Online (Sandbox Code Playgroud)

terraform

9
推荐指数
2
解决办法
1万
查看次数

在 ECS 与 AWS Batch 之间进行选择

AWS Batch 文档称它基于 ECS。

那么我们为什么不直接使用ECS呢?AWS Batch 提供了哪些 ECS 所不具备的紧迫优势?

两者都提供自动缩放功能。jbos 的排队和优先级是 AWS Batch 的唯一优势吗?

amazon-web-services amazon-ecs aws-batch

5
推荐指数
1
解决办法
4473
查看次数

如何查找 Terraform 代码中未使用的所有 tf​​vars 变量的列表?

s3.tfvars

bucket = "first-bucket"
acl="private"
env = "dev"
owner = "abc@def.com"
var1 = "unused variable"
Run Code Online (Sandbox Code Playgroud)

s3.tf

resource "aws_s3_bucket" "abucket" {
  bucket = var.bucket 
  acl = "private"

  tags = {
    Environment = var.env
    Owner = var.owner
  }
}
Run Code Online (Sandbox Code Playgroud)

var1 没有在我的代码中使用,即使它是在 tfvars 中声明的,如上所示。

当我运行以下命令时

terraform plan -var-file=s3.tfvars
Run Code Online (Sandbox Code Playgroud)

...,我收到以下警告消息:

Warning: Value for undeclared variable

The root module does not declare a variable named "var1" but a value was
found in file "s3.tfvars". To use this value, add a "variable" block to the
configuration. …
Run Code Online (Sandbox Code Playgroud)

amazon-web-services terraform

4
推荐指数
1
解决办法
5448
查看次数