Skip to content

Commit

Permalink
fix: drop data source in favour of id reference
Browse files Browse the repository at this point in the history
  • Loading branch information
Tensho committed Dec 6, 2024
1 parent 073c55d commit fb1792f
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 27 deletions.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ No modules.
| [pagerduty_service.default](https://registry.terraform.io/providers/pagerduty/pagerduty/latest/docs/resources/service) | resource |
| [pagerduty_service_dependency.dependent](https://registry.terraform.io/providers/pagerduty/pagerduty/latest/docs/resources/service_dependency) | resource |
| [pagerduty_service_dependency.supporting](https://registry.terraform.io/providers/pagerduty/pagerduty/latest/docs/resources/service_dependency) | resource |
| [pagerduty_escalation_policy.default](https://registry.terraform.io/providers/pagerduty/pagerduty/latest/docs/data-sources/escalation_policy) | data source |
| [pagerduty_team.default](https://registry.terraform.io/providers/pagerduty/pagerduty/latest/docs/data-sources/team) | data source |

## Inputs

Expand All @@ -104,14 +102,14 @@ No modules.
| <a name="input_auto_resolve_timeout"></a> [auto\_resolve\_timeout](#input\_auto\_resolve\_timeout) | PagerDuty service incident auto resolution time in seconds. | `string` | `"null"` | no |
| <a name="input_business"></a> [business](#input\_business) | PagerDuty business service vs technical service switch. | `bool` | `false` | no |
| <a name="input_description"></a> [description](#input\_description) | PagerDuty service description. | `string` | `"Managed by Terraform"` | no |
| <a name="input_escalation_policy_name"></a> [escalation\_policy\_name](#input\_escalation\_policy\_name) | PagerDuty service escalation policy name. | `string` | `null` | no |
| <a name="input_escalation_policy_id"></a> [escalation\_policy\_id](#input\_escalation\_policy\_id) | PagerDuty service escalation policy ID. | `string` | `null` | no |
| <a name="input_incident_urgency_rule"></a> [incident\_urgency\_rule](#input\_incident\_urgency\_rule) | PagerDuty service incident urgency rule. | <pre>object({<br/> type = string<br/> urgency = optional(string)<br/> during_support_hours = optional(object({<br/> type = string<br/> urgency = string<br/> }))<br/> outside_support_hours = optional(object({<br/> type = string<br/> urgency = string<br/> }))<br/> })</pre> | `null` | no |
| <a name="input_name"></a> [name](#input\_name) | PagerDuty service name | `string` | n/a | yes |
| <a name="input_point_of_contact"></a> [point\_of\_contact](#input\_point\_of\_contact) | PagerDuty business service point fo contact. | `string` | `null` | no |
| <a name="input_scheduled_actions"></a> [scheduled\_actions](#input\_scheduled\_actions) | PagerDuty service incident escalation actions related within support hours. | <pre>object({<br/> type = optional(string, "urgency_change")<br/> to_urgency = string<br/> at = object({<br/> type = optional(string, "named_time")<br/> name = string<br/> })<br/> })</pre> | `null` | no |
| <a name="input_service_graph"></a> [service\_graph](#input\_service\_graph) | PagerDuty service graph components. | <pre>object({<br/> dependent_services = optional(list(object({<br/> name = string<br/> id = string<br/> type = string<br/> })))<br/> supporting_services = optional(list(object({<br/> name = string<br/> id = string<br/> type = string<br/> })))<br/> })</pre> | <pre>{<br/> "dependent_services": [],<br/> "supporting_services": []<br/>}</pre> | no |
| <a name="input_support_hours"></a> [support\_hours](#input\_support\_hours) | PagerDuty service support hours. | <pre>object({<br/> type = optional(string, "fixed_time_per_day")<br/> time_zone = string<br/> days_of_week = list(number)<br/> start_time = string<br/> end_time = string<br/> })</pre> | `null` | no |
| <a name="input_team_name"></a> [team\_name](#input\_team\_name) | PagerDuty business service owner team (Business/Enterprise plan). | `string` | `null` | no |
| <a name="input_team_id"></a> [team\_id](#input\_team\_id) | PagerDuty business service owner team ID (Business/Enterprise plan). | `string` | `null` | no |

## Outputs

Expand Down
11 changes: 0 additions & 11 deletions data.tf

This file was deleted.

4 changes: 2 additions & 2 deletions defaults.tftest.hcl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# mock_provider "pagerduty" {}

variables {
name = "Test"
escalation_policy_name = "Primary"
name = "Test"
escalation_policy_id = "PBNPJZC"
}

run "defaults" {
Expand Down
2 changes: 1 addition & 1 deletion examples/business-service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ A basic [PagerDuty business service](https://support.pagerduty.com/main/docs/bus

## Prerequisites

* PagerDuty **team** resource has to be applied.
* PagerDuty **team** resource must exist.

## Usage

Expand Down
2 changes: 1 addition & 1 deletion examples/business-service/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ module "example" {
name = "Acme Corp Mega Service"
description = "The Acme Corp Mega Service is the most important service in the company."
point_of_contact = "acme@example.com"
team_name = "Platform"
team_id = "P8OZ082"
}
2 changes: 1 addition & 1 deletion examples/technical-service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ A basic [PagerDuty technical service](https://support.pagerduty.com/main/docs/se

## Prerequisites

* PagerDuty **escalation policy** resource has to be applied.
* PagerDuty **escalation policy** resource must exist.

## Usage

Expand Down
2 changes: 1 addition & 1 deletion examples/technical-service/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module "example" {
source = "../../"

name = "Example"
escalation_policy_name = "Primary"
escalation_policy_name = "PBNPJZC"

auto_resolve_timeout = 3600
acknowledgement_timeout = 600
Expand Down
4 changes: 2 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ resource "pagerduty_business_service" "default" {
name = var.name
description = var.description
point_of_contact = var.point_of_contact
team = data.pagerduty_team.default[0].id
team = var.team_id
}

resource "pagerduty_service" "default" {
count = var.business ? 0 : 1

name = var.name
description = var.description
escalation_policy = data.pagerduty_escalation_policy.default[0].id
escalation_policy = var.escalation_policy_id

auto_resolve_timeout = var.auto_resolve_timeout
acknowledgement_timeout = var.acknowledgement_timeout
Expand Down
8 changes: 4 additions & 4 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ variable "business" {
description = "PagerDuty business service vs technical service switch."
}

variable "team_name" {
variable "team_id" {
type = string
default = null
description = "PagerDuty business service owner team (Business/Enterprise plan)."
description = "PagerDuty business service owner team ID (Business/Enterprise plan)."
}

variable "point_of_contact" {
Expand All @@ -27,10 +27,10 @@ variable "description" {
description = "PagerDuty service description."
}

variable "escalation_policy_name" {
variable "escalation_policy_id" {
type = string
default = null
description = "PagerDuty service escalation policy name."
description = "PagerDuty service escalation policy ID."
}

variable "acknowledgement_timeout" {
Expand Down

0 comments on commit fb1792f

Please sign in to comment.