Skip to content

Commit bbae8ed

Browse files
committed
resource/aws_ssm_document: Support in-place version_name updates, add CHANGELOG entry for #14128
Output from acceptance testing in AWS Commercial: ``` --- PASS: TestAccAWSSSMDocument_params (30.50s) --- PASS: TestAccAWSSSMDocument_basic (32.24s) --- PASS: TestAccAWSSSMDocument_session (32.29s) --- PASS: TestAccAWSSSMDocument_permission_private (32.51s) --- PASS: TestAccAWSSSMDocument_permission_batching (32.78s) --- PASS: TestAccAWSSSMDocument_permission_public (32.80s) --- PASS: TestAccAWSSSMDocument_automation (37.50s) --- PASS: TestAccAWSSSMDocument_VersionName (46.97s) --- PASS: TestAccAWSSSMDocument_DocumentFormat_YAML (46.99s) --- PASS: TestAccAWSSSMDocument_target_type (48.06s) --- PASS: TestAccAWSSSMDocument_update (48.17s) --- PASS: TestAccAWSSSMDocument_SchemaVersion_1 (48.20s) --- PASS: TestAccAWSSSMDocument_Tags (57.02s) --- PASS: TestAccAWSSSMDocument_permission_change (57.33s) --- PASS: TestAccAWSSSMDocument_package (73.74s) ``` Output from acceptance testing in AWS GovCloud (US): ``` --- PASS: TestAccAWSSSMDocument_basic (34.86s) --- PASS: TestAccAWSSSMDocument_session (39.41s) --- PASS: TestAccAWSSSMDocument_params (39.84s) --- PASS: TestAccAWSSSMDocument_permission_private (40.26s) --- PASS: TestAccAWSSSMDocument_permission_public (40.37s) --- PASS: TestAccAWSSSMDocument_permission_batching (40.94s) --- PASS: TestAccAWSSSMDocument_automation (52.65s) --- PASS: TestAccAWSSSMDocument_target_type (54.33s) --- PASS: TestAccAWSSSMDocument_update (55.65s) --- PASS: TestAccAWSSSMDocument_DocumentFormat_YAML (55.72s) --- PASS: TestAccAWSSSMDocument_VersionName (55.79s) --- PASS: TestAccAWSSSMDocument_SchemaVersion_1 (55.96s) --- PASS: TestAccAWSSSMDocument_Tags (66.39s) --- PASS: TestAccAWSSSMDocument_permission_change (68.28s) --- PASS: TestAccAWSSSMDocument_package (80.15s) ```
1 parent 8ce6d55 commit bbae8ed

4 files changed

Lines changed: 13 additions & 7 deletions

File tree

.changelog/14128.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
resource/aws_ssm_document: Add `version_name` argument
3+
```

aws/resource_aws_ssm_document.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,6 @@ func resourceAwsSsmDocument() *schema.Resource {
175175
"version_name": {
176176
Type: schema.TypeString,
177177
Optional: true,
178-
Computed: true,
179-
ForceNew: true,
180178
},
181179
},
182180
}
@@ -658,6 +656,10 @@ func updateAwsSSMDocument(d *schema.ResourceData, meta interface{}) error {
658656
updateDocInput.TargetType = aws.String(v.(string))
659657
}
660658

659+
if v, ok := d.GetOk("version_name"); ok {
660+
updateDocInput.VersionName = aws.String(v.(string))
661+
}
662+
661663
if d.HasChange("attachments_source") {
662664
updateDocInput.Attachments = expandSsmAttachmentsSources(d.Get("attachments_source").([]interface{}))
663665
}

aws/resource_aws_ssm_document_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ func TestAccAWSSSMDocument_basic(t *testing.T) {
3030
testAccCheckResourceAttrRfc3339(resourceName, "created_date"),
3131
resource.TestCheckResourceAttr(resourceName, "tags.%", "0"),
3232
resource.TestCheckResourceAttrSet(resourceName, "document_version"),
33+
resource.TestCheckResourceAttr(resourceName, "version_name", ""),
3334
),
3435
},
3536
{
@@ -72,7 +73,7 @@ func TestAccAWSSSMDocument_target_type(t *testing.T) {
7273
})
7374
}
7475

75-
func TestAccAWSSSMDocument_version_name(t *testing.T) {
76+
func TestAccAWSSSMDocument_VersionName(t *testing.T) {
7677
name := acctest.RandString(10)
7778
resourceName := "aws_ssm_document.test"
7879
resource.ParallelTest(t, resource.TestCase{
@@ -659,14 +660,14 @@ DOC
659660
func testAccAWSSSMDocumentBasicConfigVersionName(rName, version string) string {
660661
return fmt.Sprintf(`
661662
resource "aws_ssm_document" "test" {
662-
name = "%s"
663+
name = %[1]q
663664
document_type = "Command"
664-
version_name = "%s"
665+
version_name = %[2]q
665666
666667
content = <<DOC
667668
{
668669
"schemaVersion": "2.0",
669-
"description": "Sample version 2.0 document v2",
670+
"description": "Sample version 2.0 document %[2]s",
670671
"parameters": {
671672
672673
},

website/docs/r/ssm_document.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ The following arguments are supported:
5454
* `document_type` - (Required) The type of the document. Valid document types include: `Automation`, `Command`, `Package`, `Policy`, and `Session`
5555
* `permissions` - (Optional) Additional Permissions to attach to the document. See [Permissions](#permissions) below for details.
5656
* `target_type` - (Optional) The target type which defines the kinds of resources the document can run on. For example, /AWS::EC2::Instance. For a list of valid resource types, see AWS Resource Types Reference (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html)
57-
* `version_name` - (Optional) A field specifying the version of the artifact you are creating with the document. For example, "Release 12, Update 6"
5857
* `tags` - (Optional) A map of tags to assign to the object.
58+
* `version_name` - (Optional) A field specifying the version of the artifact you are creating with the document. For example, "Release 12, Update 6". This value is unique across all versions of a document and cannot be changed for an existing document version.
5959

6060
## attachments_source
6161

0 commit comments

Comments
 (0)