name fields of PolicyDocument correctly in HCL (#9812)
withouth this fix we would have had to do ```hcl temporary_iam_instance_profile_policy_document { statement { action = ["*"] effect = "Allow" resource = ["*"] } version = "2012-10-17" } ``` instead of the same document but with capitalised fields
This commit is contained in:
parent
5ba134ac5b
commit
0d0bd9ce75
|
@ -53,14 +53,14 @@ type VpcFilterOptions struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type Statement struct {
|
type Statement struct {
|
||||||
Effect string
|
Effect string `mapstructure:"Effect" required:"false"`
|
||||||
Action []string
|
Action []string `mapstructure:"Action" required:"false"`
|
||||||
Resource []string
|
Resource []string `mapstructure:"Resource" required:"false"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type PolicyDocument struct {
|
type PolicyDocument struct {
|
||||||
Version string
|
Version string `mapstructure:"Version" required:"false"`
|
||||||
Statement []Statement
|
Statement []Statement `mapstructure:"Statement" required:"false"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type SecurityGroupFilterOptions struct {
|
type SecurityGroupFilterOptions struct {
|
||||||
|
|
|
@ -39,8 +39,8 @@ func (*FlatAmiFilterOptions) HCL2Spec() map[string]hcldec.Spec {
|
||||||
// FlatPolicyDocument is an auto-generated flat version of PolicyDocument.
|
// FlatPolicyDocument is an auto-generated flat version of PolicyDocument.
|
||||||
// Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
|
// Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
|
||||||
type FlatPolicyDocument struct {
|
type FlatPolicyDocument struct {
|
||||||
Version *string `cty:"version" hcl:"version"`
|
Version *string `mapstructure:"Version" required:"false" cty:"Version" hcl:"Version"`
|
||||||
Statement []FlatStatement `cty:"statement" hcl:"statement"`
|
Statement []FlatStatement `mapstructure:"Statement" required:"false" cty:"Statement" hcl:"Statement"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// FlatMapstructure returns a new FlatPolicyDocument.
|
// FlatMapstructure returns a new FlatPolicyDocument.
|
||||||
|
@ -55,8 +55,8 @@ func (*PolicyDocument) FlatMapstructure() interface{ HCL2Spec() map[string]hclde
|
||||||
// The decoded values from this spec will then be applied to a FlatPolicyDocument.
|
// The decoded values from this spec will then be applied to a FlatPolicyDocument.
|
||||||
func (*FlatPolicyDocument) HCL2Spec() map[string]hcldec.Spec {
|
func (*FlatPolicyDocument) HCL2Spec() map[string]hcldec.Spec {
|
||||||
s := map[string]hcldec.Spec{
|
s := map[string]hcldec.Spec{
|
||||||
"version": &hcldec.AttrSpec{Name: "version", Type: cty.String, Required: false},
|
"Version": &hcldec.AttrSpec{Name: "Version", Type: cty.String, Required: false},
|
||||||
"statement": &hcldec.BlockListSpec{TypeName: "statement", Nested: hcldec.ObjectSpec((*FlatStatement)(nil).HCL2Spec())},
|
"Statement": &hcldec.BlockListSpec{TypeName: "Statement", Nested: hcldec.ObjectSpec((*FlatStatement)(nil).HCL2Spec())},
|
||||||
}
|
}
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
@ -89,9 +89,9 @@ func (*FlatSecurityGroupFilterOptions) HCL2Spec() map[string]hcldec.Spec {
|
||||||
// FlatStatement is an auto-generated flat version of Statement.
|
// FlatStatement is an auto-generated flat version of Statement.
|
||||||
// Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
|
// Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
|
||||||
type FlatStatement struct {
|
type FlatStatement struct {
|
||||||
Effect *string `cty:"effect" hcl:"effect"`
|
Effect *string `mapstructure:"Effect" required:"false" cty:"Effect" hcl:"Effect"`
|
||||||
Action []string `cty:"action" hcl:"action"`
|
Action []string `mapstructure:"Action" required:"false" cty:"Action" hcl:"Action"`
|
||||||
Resource []string `cty:"resource" hcl:"resource"`
|
Resource []string `mapstructure:"Resource" required:"false" cty:"Resource" hcl:"Resource"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// FlatMapstructure returns a new FlatStatement.
|
// FlatMapstructure returns a new FlatStatement.
|
||||||
|
@ -106,9 +106,9 @@ func (*Statement) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spe
|
||||||
// The decoded values from this spec will then be applied to a FlatStatement.
|
// The decoded values from this spec will then be applied to a FlatStatement.
|
||||||
func (*FlatStatement) HCL2Spec() map[string]hcldec.Spec {
|
func (*FlatStatement) HCL2Spec() map[string]hcldec.Spec {
|
||||||
s := map[string]hcldec.Spec{
|
s := map[string]hcldec.Spec{
|
||||||
"effect": &hcldec.AttrSpec{Name: "effect", Type: cty.String, Required: false},
|
"Effect": &hcldec.AttrSpec{Name: "Effect", Type: cty.String, Required: false},
|
||||||
"action": &hcldec.AttrSpec{Name: "action", Type: cty.List(cty.String), Required: false},
|
"Action": &hcldec.AttrSpec{Name: "Action", Type: cty.List(cty.String), Required: false},
|
||||||
"resource": &hcldec.AttrSpec{Name: "resource", Type: cty.List(cty.String), Required: false},
|
"Resource": &hcldec.AttrSpec{Name: "Resource", Type: cty.List(cty.String), Required: false},
|
||||||
}
|
}
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
<!-- Code generated from the comments of the PolicyDocument struct in builder/amazon/common/run_config.go; DO NOT EDIT MANUALLY -->
|
||||||
|
|
||||||
|
- `Version` (string) - Version
|
||||||
|
|
||||||
|
- `Statement` ([]Statement) - Statement
|
|
@ -0,0 +1,7 @@
|
||||||
|
<!-- Code generated from the comments of the Statement struct in builder/amazon/common/run_config.go; DO NOT EDIT MANUALLY -->
|
||||||
|
|
||||||
|
- `Effect` (string) - Effect
|
||||||
|
|
||||||
|
- `Action` ([]string) - Action
|
||||||
|
|
||||||
|
- `Resource` ([]string) - Resource
|
Loading…
Reference in New Issue