diff --git a/backend/s3/create.go b/backend/s3/create.go index 498073d..6b20d3d 100644 --- a/backend/s3/create.go +++ b/backend/s3/create.go @@ -15,9 +15,10 @@ func createBackendConfigurationFile(in stateConfig) error { {{ if .Region }}region = "{{ .Region }}"{{ end }} {{ if .Key }}key = "{{ .Key }}"{{ end }} {{ if .DynamoDBTable }}dynamodb_table = "{{ .DynamoDBTable }}"{{ end }} + {{ if .ACL }}acl = "{{ .ACL }}"{{ end }} } } - `) +`) if err != nil { color.Red(err.Error()) return err diff --git a/backend/s3/parsercall.go b/backend/s3/parsercall.go index 0dec2b7..2770d31 100644 --- a/backend/s3/parsercall.go +++ b/backend/s3/parsercall.go @@ -33,5 +33,11 @@ func callParserForBackendParameters(in interface{}, out *stateConfig) error { } out.Region = helper.GetStringAfterSettingPlaceholderValues(region) + acl, _, err := varParser.GetBackendParameterString("acl", true) + if err != nil { + return err + } + out.ACL = helper.GetStringAfterSettingPlaceholderValues(acl) + return nil } diff --git a/backend/s3/types.go b/backend/s3/types.go index 36ea385..5ab04d0 100644 --- a/backend/s3/types.go +++ b/backend/s3/types.go @@ -5,4 +5,5 @@ type stateConfig struct { DynamoDBTable string Key string Region string + ACL string } diff --git a/helper/output.go b/helper/output.go index 19aeaf8..8af8020 100644 --- a/helper/output.go +++ b/helper/output.go @@ -11,7 +11,10 @@ func PrintStateValues(in interface{}) { fmt.Println("------- Using the following values -------") for i := 0; i < v.NumField(); i++ { name := v.Type().Field(i).Name - fmt.Printf("%s = %s \n", name, v.Field(i).Interface()) + value := v.Field(i).Interface() + if value != "" { + fmt.Printf("%s = %s \n", name, v.Field(i).Interface()) + } } fmt.Println("------------------------------------------") } diff --git a/test/test.tfvars b/test/test.tfvars index 6cd8e25..9786c7a 100644 --- a/test/test.tfvars +++ b/test/test.tfvars @@ -12,4 +12,6 @@ state_key = "terrastate/{{ current.dir }}/terraform.tfstate" state_auto_remove_old = true +acl = "bucket-owner-full-control" + stage = "test"