Terraform>指定的键不存在

时间:2021-07-10 19:14:26

Running terraform plan is complaining that there's no S3 key in my bucket. Note: this key does not exist however I'm pretty sure Terraform is supposed to create this if it doesn't. The log is:

运行terraform计划抱怨我的桶里没有S3密钥。注意:这个键不存在但是我很确定Terraform应该创建它,如果它没有。日志是:

[DEBUG] [aws-sdk-go] <?xml version="1.0" encoding="UTF-8"?>
<Error><Code>NoSuchKey</Code><Message>The specified key does not exist.</Message><Key>my-key</Key>

and the Terraform config is:

和Terraform配置是:

terraform {
  backend "s3" {
    bucket = "<bucket>"
    key = "my-key"
    region = "eu-west-2"
    acl        = "private"
    kms_key_id = "<key>"    
  }
}

Any suggestions?

有什么建议么?

1 个解决方案

#1


1  

You need to run terraform init before terraform plan to initialise the backend you have configured.

您需要在terraform计划之前运行terraform init以初始化已配置的后端。

#1


1  

You need to run terraform init before terraform plan to initialise the backend you have configured.

您需要在terraform计划之前运行terraform init以初始化已配置的后端。