From 373ead8e50d3c18f8dd14baba639f14badc03238 Mon Sep 17 00:00:00 2001 From: Nikita Pivkin Date: Fri, 8 Dec 2023 21:37:54 +0700 Subject: [PATCH] feat(terraform): fill in the arn attribute for bucket --- pkg/terraform/presets.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/terraform/presets.go b/pkg/terraform/presets.go index c6a46da31..58879d809 100644 --- a/pkg/terraform/presets.go +++ b/pkg/terraform/presets.go @@ -1,6 +1,7 @@ package terraform import ( + "fmt" "strings" "github.com/zclconf/go-cty/cty" @@ -38,5 +39,14 @@ func postProcessValues(b *Block, input map[string]cty.Value) map[string]cty.Valu } } + switch b.TypeLabel() { + case "aws_s3_bucket": + var bucketName string + if bucket := input["bucket"]; bucket.Type().Equals(cty.String) { + bucketName = bucket.AsString() + } + input["arn"] = cty.StringVal(fmt.Sprintf("arn:aws:s3:::%s", bucketName)) + } + return input }