Skip to content

Commit

Permalink
Merge pull request #7838 from terraform-providers/f-aws_ssm_patch_bas…
Browse files Browse the repository at this point in the history
…eline-import

resource/aws_ssm_patch_baseline: Support resource import
  • Loading branch information
bflad authored Mar 14, 2019
2 parents 96e6036 + c3d363d commit 5928177
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
3 changes: 3 additions & 0 deletions aws/resource_aws_ssm_patch_baseline.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ func resourceAwsSsmPatchBaseline() *schema.Resource {
Read: resourceAwsSsmPatchBaselineRead,
Update: resourceAwsSsmPatchBaselineUpdate,
Delete: resourceAwsSsmPatchBaselineDelete,
Importer: &schema.ResourceImporter{
State: schema.ImportStatePassthrough,
},

Schema: map[string]*schema.Schema{
"name": {
Expand Down
12 changes: 11 additions & 1 deletion aws/resource_aws_ssm_patch_baseline_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ func TestAccAWSSSMPatchBaseline_basic(t *testing.T) {
"aws_ssm_patch_baseline.foo", "description", "Baseline containing all updates approved for production systems"),
),
},
{
ResourceName: "aws_ssm_patch_baseline.foo",
ImportState: true,
ImportStateVerify: true,
},
{
Config: testAccAWSSSMPatchBaselineBasicConfigUpdated(name),
Check: resource.ComposeTestCheckFunc(
Expand Down Expand Up @@ -85,7 +90,7 @@ func TestAccAWSSSMPatchBaseline_disappears(t *testing.T) {
})
}

func TestAccAWSSSMPatchBaselineWithOperatingSystem(t *testing.T) {
func TestAccAWSSSMPatchBaseline_OperatingSystem(t *testing.T) {
var before, after ssm.PatchBaselineIdentity
name := acctest.RandString(10)
resource.ParallelTest(t, resource.TestCase{
Expand All @@ -111,6 +116,11 @@ func TestAccAWSSSMPatchBaselineWithOperatingSystem(t *testing.T) {
"aws_ssm_patch_baseline.foo", "operating_system", "AMAZON_LINUX"),
),
},
{
ResourceName: "aws_ssm_patch_baseline.foo",
ImportState: true,
ImportStateVerify: true,
},
{
Config: testAccAWSSSMPatchBaselineConfigWithOperatingSystemUpdated(name),
Check: resource.ComposeTestCheckFunc(
Expand Down
8 changes: 8 additions & 0 deletions website/docs/r/ssm_patch_baseline.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,11 @@ The `approval_rule` block supports:
In addition to all arguments above, the following attributes are exported:

* `id` - The ID of the patch baseline.

## Import

SSM Patch Baselines can be imported by their baseline ID, e.g.

```
$ terraform import aws_ssm_patch_baseline.example pb-12345678
```

0 comments on commit 5928177

Please sign in to comment.