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

Remove status as it is not required #133

Merged
merged 3 commits into from
Jul 26, 2019
Merged

Conversation

rodrigomgm
Copy link
Contributor

If service status is "warning" or "critical" Pagerduty API will reject as it only accepts "active" or "disabled".

Having the Status as part of the payload will make cause the apply to fail if either "warning" or "critical" status. However not having it as part of the payload makes the Pagerduty accept the changes.

If status is "warning" or "critical" Pagerduty API will reject as it only accepts "active" or "disabled".
@ghost ghost added the size/XS label May 20, 2019
Copy link
Contributor

@pdecat pdecat left a comment

Choose a reason for hiding this comment

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

Great finding! I believe however there's a better way to fix this (please see my review comment).

@@ -276,7 +276,6 @@ func resourcePagerDutyServiceRead(d *schema.ResourceData, meta interface{}) erro
}

d.Set("name", service.Name)
d.Set("status", service.Status)
Copy link
Contributor

Choose a reason for hiding this comment

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

Removing this effectively renders the status field useless.
This should be kept to be able to read the current status of service.

I'd rather alter buildServiceStruct() to not set pagerduty.Service.status as it is a Computed field:
https://github.com/terraform-providers/terraform-provider-pagerduty/blob/9aca2da0cae321fd15db99d82bcaa6057e771e71/pagerduty/resource_pagerduty_service.go#L192

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Patrick,
the status for this matter is useless anyway, but I see your point and I agree that is better to remove it from buildServiceStruct, updated the PR

rodrigomgm and others added 2 commits May 21, 2019 10:04
revert the READ function to have the status, but removed status from buildServiceStruct
Copy link
Contributor

@pdecat pdecat left a comment

Choose a reason for hiding this comment

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

LGTM!

# git status
On branch fork-rodrigomgm-master
Your branch is up to date with 'fork-rodrigomgm/master'.
# git log -n 1
commit bb7509f47ffcba28370cdb8206b42760a4c35057 (HEAD -> fork-rodrigomgm-master, fork-rodrigomgm/master)
Author: Rodrigo Goncalves <rgoncalves@tyro.com>
Date:   Tue May 21 10:44:17 2019 +1000

    gofmt applied
# make testacc TESTARGS='-run=TestAccPagerDutyService_.* -count=1'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test "./pagerduty" -v -run=TestAccPagerDutyService_.* -count=1 -timeout 120m
=== RUN   TestAccPagerDutyService_import
--- PASS: TestAccPagerDutyService_import (13.81s)
=== RUN   TestAccPagerDutyService_Basic
--- PASS: TestAccPagerDutyService_Basic (25.75s)
=== RUN   TestAccPagerDutyService_BasicWithIncidentUrgencyRules
--- PASS: TestAccPagerDutyService_BasicWithIncidentUrgencyRules (26.39s)
=== RUN   TestAccPagerDutyService_FromBasicToCustomIncidentUrgencyRules
--- PASS: TestAccPagerDutyService_FromBasicToCustomIncidentUrgencyRules (19.00s)
=== RUN   TestAccPagerDutyService_SupportHoursChange
--- PASS: TestAccPagerDutyService_SupportHoursChange (19.79s)
PASS
ok      github.com/terraform-providers/terraform-provider-pagerduty/pagerduty   104.758s

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.

Hi @rodrigomgm,

sorry for the delay on this one. 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.

3 participants