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

provider/pagerduty: pagerduty_schedule data source #11614

Merged
merged 4 commits into from
Feb 1, 2017

Conversation

heimweh
Copy link
Contributor

@heimweh heimweh commented Feb 1, 2017

This PR adds a new data source pagerduty_schedule

So far, the only thing we store is the actual ID of the resource,
but can easily be extended to export more attributes in the future.

Example usage:

data "pagerduty_schedule" "test" {
  name = "Daily Engineering Rotation"
}

resource "pagerduty_escalation_policy" "test" {
  name      = "Engineering Escalation Policy"
  num_loops = 2

  rule {
    escalation_delay_in_minutes = 10

    target {
      type = "schedule_reference"
      id   = "${data.pagerduty_schedule.test.id}"
    }
  }
}

@heimweh heimweh force-pushed the datasource_schedule branch 2 times, most recently from de8c640 to a4b278c Compare February 1, 2017 18:39
@heimweh
Copy link
Contributor Author

heimweh commented Feb 1, 2017

Tests are passing:

$ make testacc TEST=./builtin/providers/pagerduty TESTARGS='-run=TestAccDataSourcePagerDutySchedule_Basic'                                                                                          19:24:10
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/02/01 19:24:16 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/pagerduty -v -run=TestAccDataSourcePagerDutySchedule_Basic -timeout 120m
=== RUN   TestAccDataSourcePagerDutySchedule_Basic
--- PASS: TestAccDataSourcePagerDutySchedule_Basic (6.45s)
PASS
ok  	github.com/hashicorp/terraform/builtin/providers/pagerduty	6.465s

Copy link
Contributor

@stack72 stack72 left a comment

Choose a reason for hiding this comment

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

1 small comment but LGTM!

Read: dataSourcePagerDutyScheduleRead,

Schema: map[string]*schema.Schema{
"id": {
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't need the ID here - Id is exposed internally

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah good catch, that's true. I'll push a fix straight away 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Pushed a fix now to both data sources 🙂

@stack72
Copy link
Contributor

stack72 commented Feb 1, 2017

LGTM!

@stack72 stack72 merged commit 2c59c9d into hashicorp:master Feb 1, 2017
stack72 pushed a commit that referenced this pull request Feb 1, 2017
* Add data source

* Add tests

* Add documentation

* Remove unnecessary id from schema
arcadiatea pushed a commit to ticketmaster/terraform that referenced this pull request Feb 9, 2017
* Add data source

* Add tests

* Add documentation

* Remove unnecessary id from schema
@ghost
Copy link

ghost commented Apr 17, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants