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) AWS Batch 文档称它基于 ECS。
那么我们为什么不直接使用ECS呢?AWS Batch 提供了哪些 ECS 所不具备的紧迫优势?
两者都提供自动缩放功能。jbos 的排队和优先级是 AWS Batch 的唯一优势吗?
bucket = "first-bucket"
acl="private"
env = "dev"
owner = "abc@def.com"
var1 = "unused variable"
Run Code Online (Sandbox Code Playgroud)
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)