Skip to content

Commit

Permalink
Merge pull request #9127 from stack72/stack72/gh-9104
Browse files Browse the repository at this point in the history
resource/ssm_parameter: Add version as output
  • Loading branch information
bflad authored Jun 27, 2019
2 parents 1bb0dea + 4f689d6 commit 768ca02
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions aws/data_source_aws_ssm_parameter.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ func dataSourceAwsSsmParameter() *schema.Resource {
Optional: true,
Default: true,
},
"version": {
Type: schema.TypeInt,
Computed: true,
},
},
}
}
Expand Down Expand Up @@ -72,6 +76,7 @@ func dataAwsSsmParameterRead(d *schema.ResourceData, meta interface{}) error {
d.Set("name", param.Name)
d.Set("type", param.Type)
d.Set("value", param.Value)
d.Set("version", param.Version)

return nil
}
1 change: 1 addition & 0 deletions aws/data_source_aws_ssm_parameter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ func TestAccAWSSsmParameterDataSource_basic(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "type", "String"),
resource.TestCheckResourceAttr(resourceName, "value", "TestValue"),
resource.TestCheckResourceAttr(resourceName, "with_decryption", "false"),
resource.TestCheckResourceAttrSet(resourceName, "version"),
),
},
{
Expand Down
5 changes: 5 additions & 0 deletions aws/resource_aws_ssm_parameter.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ func resourceAwsSsmParameter() *schema.Resource {
Type: schema.TypeString,
Optional: true,
},
"version": {
Type: schema.TypeInt,
Computed: true,
},
"tags": tagsSchema(),
},

Expand Down Expand Up @@ -121,6 +125,7 @@ func resourceAwsSsmParameterRead(d *schema.ResourceData, meta interface{}) error
d.Set("name", param.Name)
d.Set("type", param.Type)
d.Set("value", param.Value)
d.Set("version", param.Version)

describeParamsInput := &ssm.DescribeParametersInput{
ParameterFilters: []*ssm.ParameterStringFilter{
Expand Down
1 change: 1 addition & 0 deletions aws/resource_aws_ssm_parameter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ func TestAccAWSSSMParameter_basic(t *testing.T) {
resource.TestCheckResourceAttr("aws_ssm_parameter.foo", "tier", "Standard"),
resource.TestCheckResourceAttr("aws_ssm_parameter.foo", "tags.%", "1"),
resource.TestCheckResourceAttr("aws_ssm_parameter.foo", "tags.Name", "My Parameter"),
resource.TestCheckResourceAttrSet("aws_ssm_parameter.foo", "version"),
),
},
},
Expand Down
1 change: 1 addition & 0 deletions website/docs/d/ssm_parameter.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ In addition to all arguments above, the following attributes are exported:
* `name` - The name of the parameter.
* `type` - The type of the parameter. Valid types are `String`, `StringList` and `SecureString`.
* `value` - The value of the parameter.
* `version` - The version of the parameter.
1 change: 1 addition & 0 deletions website/docs/r/ssm_parameter.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ In addition to all arguments above, the following attributes are exported:
* `description` - (Required) The description of the parameter.
* `type` - (Required) The type of the parameter. Valid types are `String`, `StringList` and `SecureString`.
* `value` - (Required) The value of the parameter.
* `version` - The version of the parameter.

## Import

Expand Down

0 comments on commit 768ca02

Please sign in to comment.