Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resource/aws_ssm_patch_baseline: Support resource import #7838

Merged
merged 1 commit into from
Mar 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
```