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 Tag and Tag Assignment resources. Also Tag Data Source. #402

Merged
merged 10 commits into from
Oct 11, 2021

Conversation

stmcallister
Copy link
Contributor

Adding pagerduty_tag and pagerduty_tag_assignment resources as well as pagerduty_tag data source. Here are the test results for those additions.

$ TF_ACC=1 go test -run "TestAccPagerDutyTagAssignment" ./pagerduty -v -timeout 120m 
=== RUN   TestAccPagerDutyTagAssignment_import
--- PASS: TestAccPagerDutyTagAssignment_import (8.74s)
=== RUN   TestAccPagerDutyTagAssignment_User
--- PASS: TestAccPagerDutyTagAssignment_User (8.58s)
=== RUN   TestAccPagerDutyTagAssignment_Team
--- PASS: TestAccPagerDutyTagAssignment_Team (6.43s)
=== RUN   TestAccPagerDutyTagAssignment_EP
--- PASS: TestAccPagerDutyTagAssignment_EP (9.90s)
PASS
ok      github.com/terraform-providers/terraform-provider-pagerduty/pagerduty   34.224s
$ TF_ACC=1 go test -run "TestAccDataSourcePagerDutyTag" ./pagerduty -v -timeout 120m
=== RUN   TestAccDataSourcePagerDutyTag_Basic
--- PASS: TestAccDataSourcePagerDutyTag_Basic (3.29s)
PASS
ok      github.com/terraform-providers/terraform-provider-pagerduty/pagerduty   3.861s

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.

Nice work @stmcallister 🎉 I left a few inline comments 🙂

pagerduty/resource_pagerduty_tag_assignment.go Outdated Show resolved Hide resolved
pagerduty/resource_pagerduty_tag_assignment_test.go Outdated Show resolved Hide resolved
}
log.Printf("[INFO] Deleting PagerDuty tag assignment with tagID %s for entityID %s", assignment.TagID, assignment.EntityID)

retryErr := resource.Retry(10*time.Second, func() *resource.RetryError {
Copy link
Collaborator

Choose a reason for hiding this comment

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

We could also return the result of Retry() here I think like we do in the Read() func 🙂

	return resource.Retry(10*time.Second, func() *resource.RetryError {
		if _, err := client.Tags.Assign(assignment.EntityType, assignment.EntityID, assignments); err != nil {
			if isErrCode(err, 400) || isErrCode(err, 429) {
				return resource.RetryableError(err)
			}

			return resource.NonRetryableError(err)
		} else {
			d.SetId("")
		}
		return nil
	})

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@heimweh Isn't that what I'm doing on line 149?

Copy link
Collaborator

Choose a reason for hiding this comment

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

website/docs/d/tag.html.markdown Show resolved Hide resolved
@stmcallister stmcallister merged commit 23ba885 into PagerDuty:master Oct 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants