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

r/pagerduty_escalation_policy: correctly set teams #129

Merged
merged 1 commit into from
May 25, 2019
Merged

r/pagerduty_escalation_policy: correctly set teams #129

merged 1 commit into from
May 25, 2019

Conversation

gordonbondon
Copy link
Contributor

While working on #126 I've discovered this error:

make testacc TEST=./pagerduty TESTARGS='-run=TestAccPagerDutyEscalationPolicyWithTeams_Basic'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./pagerduty -v -run=TestAccPagerDutyEscalationPolicyWithTeams_Basic -timeout 120m
=== RUN   TestAccPagerDutyEscalationPolicyWithTeams_Basic
--- FAIL: TestAccPagerDutyEscalationPolicyWithTeams_Basic (19.53s)
    testing.go:629: Error destroying resource! WARNING: Dangling resources
        may exist. The full state and error is shown below.

        Error: errors during apply: DELETE API call to https://api.pagerduty.com/teams/P3NAB0C failed 400 Bad Request. Code: 6006, Errors: [Cannot delete team with existing associations; associations could be Escalation Policies, Services, Schedules or Subteams], Message: Team has existing associations

        State: pagerduty_team.foo:
          ID = P3NAB0C
          provider = provider.pagerduty
          description = foo
          name = tf-xog7u
FAIL
FAIL	github.com/terraform-providers/terraform-provider-pagerduty/pagerduty	19.562s
make: *** [testacc] Error 1

Teams attribute was not correctly set on read and underlying pagerduty sdk was not actually removing teams from policy. So terraform was trying to remove both resources in parallel.

This fix depends on fix in pagerduty go library heimweh/go-pagerduty#25

Acceptance tests after fix:

→ GOFLAGS=-mod=vendor make testacc TEST=./pagerduty TESTARGS='-run=TestAccPagerDutyEscalationPolicy'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./pagerduty -v -run=TestAccPagerDutyEscalationPolicy -timeout 120m
=== RUN   TestAccPagerDutyEscalationPolicy_import
--- PASS: TestAccPagerDutyEscalationPolicy_import (14.44s)
=== RUN   TestAccPagerDutyEscalationPolicy_Basic
--- PASS: TestAccPagerDutyEscalationPolicy_Basic (20.58s)
=== RUN   TestAccPagerDutyEscalationPolicyWithTeams_Basic
--- PASS: TestAccPagerDutyEscalationPolicyWithTeams_Basic (21.20s)
PASS
ok  	github.com/terraform-providers/terraform-provider-pagerduty/pagerduty	56.243s

@heimweh
Copy link
Collaborator

heimweh commented Apr 19, 2019

Hi @gordonbondon,

this looks good to me. Would you mind opening a PR with a vendor update as well?

Thank you so much! 🙏

@gordonbondon
Copy link
Contributor Author

@heimweh here you go #130

Copy link
Collaborator

@heimweh heimweh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @gordonbondon 🙏 This LGTM 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants