Skip to content

Commit

Permalink
feat(terraform): fill in the arn attribute for bucket (#1506)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikpivkin authored Dec 11, 2023
1 parent 6c7b981 commit 4ab1fa8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/terraform/presets.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package terraform

import (
"fmt"
"strings"

"github.com/zclconf/go-cty/cty"
Expand Down Expand Up @@ -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
}

0 comments on commit 4ab1fa8

Please sign in to comment.