Update/delete aws_s3_object results in “InvalidArgument: Invalid attribute name specified.”

huangapple go评论59阅读模式
英文:

Update/delete aws_s3_object results in "InvalidArgument: Invalid attribute name specified."

问题

我有一个项目,使用Terraform创建AWS IoT证书并将它们存储在Amazon S3存储桶中。

我使用aws_s3_object和内容属性来存储证书:

resource "aws_iot_certificate" "this" {
  count = length(aws_iot_thing.this)

  active = true
}

resource "aws_s3_object" "public_key" {
  count = length(var.things)

  bucket  = module.s3_bucket.s3_bucket_id
  key     = "certificate/${var.things[count.index].customer_id}/public_key.pem"
  content = aws_iot_certificate.this[count.index].public_key
}

该应用程序可以正常工作,但当我尝试创建或销毁对象时,Terraform总是给我这个错误:

Error: deleting S3 Bucket (xxxxxxx) Object (certificate/xxxx/public_key.pem): InvalidArgument: Invalid attribute name specified. status code: 400, request id: xxxxx, host id: xxxx

我尝试使用一个常量键,比如"test/public_key.pem",但结果相同。

英文:

I have a project where I create AWS IoT certificates using Terraform and store them in an Amazon S3 bucket.

I store the certificates using aws_s3_object and the content attribute:

resource "aws_iot_certificate" "this" {
  count = length(aws_iot_thing.this)

  active = true
}

resource "aws_s3_object" "public_key" {
  count = length(var.things)

  bucket  = module.s3_bucket.s3_bucket_id
  key     = "certificate/${var.things[count.index].customer_id}/public_key.pem"
  content = aws_iot_certificate.this[count.index].public_key
}

The application works, but when I try to create or destroy the objects, Terraform always gives me this error:

Error: deleting S3 Bucket (xxxxxxx) Object (certificate/xxxx/public_key.pem): InvalidArgument: Invalid attribute name specified. status code: 400, request id: xxxxx, host id: xxxx

I tried to use a constant key like "test/public_key.pem", with the same result.

答案1

得分: 0

问题如jarmod提到的那样,已在Terraform AWS提供程序的问题32307中提到,并在提供程序版本5.6.2中修复。

英文:

Like jarmod mentioned the problem was mentioned in the Terraform AWS provider issue 32307 and fixed in the provider version 5.6.2.

huangapple
  • 本文由 发表于 2023年7月3日 22:01:03
  • 转载请务必保留本文链接:https://go.coder-hub.com/76605499.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定