Skip to content

Commit

Permalink
Merge pull request #31 from janritter/feat/support-for-s3-acl
Browse files Browse the repository at this point in the history
feat: added support for s3 acl variable
  • Loading branch information
janritter authored Aug 19, 2020
2 parents e41a402 + a1b0280 commit 69da75f
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 2 deletions.
3 changes: 2 additions & 1 deletion backend/s3/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions backend/s3/parsercall.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
1 change: 1 addition & 0 deletions backend/s3/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ type stateConfig struct {
DynamoDBTable string
Key string
Region string
ACL string
}
5 changes: 4 additions & 1 deletion helper/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -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("------------------------------------------")
}
2 changes: 2 additions & 0 deletions test/test.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ state_key = "terrastate/{{ current.dir }}/terraform.tfstate"

state_auto_remove_old = true

acl = "bucket-owner-full-control"

stage = "test"

0 comments on commit 69da75f

Please sign in to comment.