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

Adding Response Plays Resource #278

Merged
merged 19 commits into from
Nov 16, 2020
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ module github.com/terraform-providers/terraform-provider-pagerduty
go 1.14

require (
cloud.google.com/go/pubsub v1.8.3 // indirect
github.com/google/go-querystring v1.0.0 // indirect
github.com/hashicorp/terraform-plugin-sdk v1.7.0
github.com/heimweh/go-pagerduty v0.0.0-20200724060021-1df9f265c5b7
github.com/heimweh/go-pagerduty v0.0.0-20201024013827-a2305891a4c0

)
459 changes: 459 additions & 0 deletions go.sum

Large diffs are not rendered by default.

38 changes: 38 additions & 0 deletions pagerduty/import_pagerduty_response_play_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package pagerduty

import (
"fmt"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/helper/acctest"
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/terraform"
)

func TestAccPagerDutyResponsePlay_import(t *testing.T) {
name := fmt.Sprintf("tf-%s", acctest.RandString(5))

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckPagerDutyResponsePlayDestroy,
Steps: []resource.TestStep{
{
Config: testAccCheckPagerDutyResponsePlayConfig(name),
},

{
ResourceName: "pagerduty_response_play.foo",
ImportStateIdFunc: testAccCheckPagerDutyResponsePlayID,
ImportState: true,
ImportStateVerify: true,
},
},
})
}

func testAccCheckPagerDutyResponsePlayID(s *terraform.State) (string, error) {
ua := s.RootModule().Resources["pagerduty_response_play.foo"].Primary.Attributes

return fmt.Sprintf("%v.%v", s.RootModule().Resources["pagerduty_response_play.foo"].Primary.ID, ua["from"]), nil
}
1 change: 1 addition & 0 deletions pagerduty/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ func Provider() terraform.ResourceProvider {
"pagerduty_ruleset_rule": resourcePagerDutyRulesetRule(),
"pagerduty_business_service": resourcePagerDutyBusinessService(),
"pagerduty_service_dependency": resourcePagerDutyServiceDependency(),
"pagerduty_response_play": resourcePagerDutyResponsePlay(),
},
}

Expand Down
Loading