Skip to content

Commit

Permalink
Merge pull request #9 from dheeruk12/main
Browse files Browse the repository at this point in the history
added Terraform Import
  • Loading branch information
vishwa306 authored Jul 28, 2022
2 parents c0958d2 + 62554f2 commit ffebdbf
Show file tree
Hide file tree
Showing 41 changed files with 1,804 additions and 245 deletions.
19 changes: 19 additions & 0 deletions docs/data-sources/zenduty_alertrules.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,25 @@ output "zenduty_alertrules" {
* `integration_id`(Required) - unique_id of the integration
* `alert_rule_id`(Optional) - unique_id of the alert rule

## Attributes Reference

The following attributes are exported as list of maps:

* `unique_id` - The unique_id of the alert rule
* `description` - The description of the alert rule
* `rule_json` - The JSON representation of the alert rule
* `actions` - The actions of the alert rule as a list of maps:
* `unique_id` - The unique_id of the action
* `action_type` - The type of the action
* `escalation_policy` - Unique id of the escalation policy (only if action_type ` 4`)
* `assign_to` - The assign_to of the action (only if action_type is `6`)
* `sla` - Unique_id of the sla (only if action_type is `14`)
* `team_priority` Unique_id of the team priority (only if action_type is `15`)
* `value` - The value of the action (only if action_type not in `3`, `4`, `6`, `14`, `15`)







Expand Down
19 changes: 19 additions & 0 deletions docs/data-sources/zenduty_esp.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,25 @@ output "esps" {
* `esp_id`(Optional) - The UniqueID of the ESP to query.along with team id
<!-- schema generated by tfplugindocs -->

## Attributes Reference
The following attributes are exported as list of maps:

* `unique_id` - The UniqueID of the ESP.
* `name` - The name of the ESP.
* `description` - The description of the ESP.
* `team` - The unique_id of team that the ESP belongs to.
* `rules` - The list of rules that the ESP has.
The following attributes are exported as list of maps:
`delay` - The delay of the rule in minutes.
`targets` - The list of targets that the rule applies to.
`target_type` - The type of the target.
`target_id` - The unique_id of the target.
* `repeat_policy` - Number of times the ESP should repeat.
* `move_to_next`(bool) - Whether the ESP should move to the next ESP.






### Required
Expand Down
17 changes: 17 additions & 0 deletions docs/data-sources/zenduty_integrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,23 @@ output "integrations" {

<!-- schema generated by tfplugindocs -->

## Attributes Reference

The following attributes are exported as list of maps:

* `unique_id` - The UniqueID of the integration.
* `name` - The name of the integration.
* `summary` - The summary of the integration.
* `service` - The unique_id of service that the integration belongs to.
* `application` - The unique_id of application that the integration belongs to.
* `integration_key` - The integration key of the integration.
* `webhook_url` - The webhook url of the integration.to send alerts to.
* `default_urgency` - The default urgency of the incidents for this integration.
* `create_incident_for` - Type of Alerts to create an incident.`0`:Don't create incidents,`1`:critical alerts, `2`:critical and error alerts,`3`:critical, error and warning alerts
* `created_by` - The unique_id of the user that created the integration.



### Required

- **service_id** (String)
Expand Down
17 changes: 17 additions & 0 deletions docs/data-sources/zenduty_maintenance_window.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,23 @@ output "zenduty_maintenance_window" {
* `team_id`(Required) - The UniqueID of the team to query.


## Attributes Reference

The following attributes are exported as list of maps:


* `name` - The name of the maintenance window.
* `unique_id` - The unique_id of the maintenance window.
* `team_id` - The unique_id of the team to create the maintenance window in.
* `start_time` - The start time of the maintenance window in the format of "YYYY-MM-DD HH:MM".
* `end_time` - The end time of the maintenance window in the format of "YYYY-MM-DD HH:MM".
* `timezone` - The timezone of the maintenance window.
* `services` - The service ids that are associated with the maintenance window.These attributes are returned as a list of maps.
* `service` - The unique_id of the service.
* `repeat_interval` - The repeat interval of the maintenance window.
* `repeat_until` - The repeat until of the maintenance window in the format of "YYYY-MM-DD HH:MM".





12 changes: 12 additions & 0 deletions docs/data-sources/zenduty_priorities.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,15 @@ output "zenduty_priorities" {
* `team_id`(Required) - The UniqueID of the team to query.


## Attributes Reference

The following attributes are exported as list of maps:

* `unique_id` - The UniqueID of the priority.
* `name` - The name of the priority.
* `description` - The description of the priority.
* `team` - The unique_id of team that the priority belongs to.
* `color` - The color of the priority.



11 changes: 11 additions & 0 deletions docs/data-sources/zenduty_roles.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@ output "zenduty_roles" {

* `team_id`(Required) - The UniqueID of the team to query.

### Attributes Reference

The following attributes are exported as list of maps:

* `team` - The unique_id of team that the role belongs to.
* `title` - The title of the role.
* `description` - The description of the role.
* `unique_id` - The unique_id of the role.
* `rank` - The rank of the role.


<!-- schema generated by tfplugindocs -->


Expand Down
31 changes: 31 additions & 0 deletions docs/data-sources/zenduty_schedules.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,37 @@ output "schedules" {
* `team_id`(Required) - The UniqueID of the team to query.
* `schedule_id`(Optional) - The UniqueID of the schedule to query.along with team id

## Attributes Reference

The following attributes are exported as list of maps:

* `name` - The name of the schedule.
* `unique_id` - The unique_id of the schedule.
* `team` - The unique_id of the team.
* `description` - The description of the schedule.
* `summary` - The summary of the schedule.
* `time_zone` - The time_zone of the schedule.
* `layers` - The layers of the schedule as a list of maps.
* `name` - The name of the layer.
* `shift_length` - The shift length of the layer in seconds.
* `rotation_start_time` - start time of the layer.
* `rotation_end_time` - end time of the layer.
* `restriction_type` - The restriction_type of the layer. ex: `1` for day, `2` for week ,`0` for default
* `users` - The list of users in the layer.
* `username` - The username of the user.
* `position` - The position of the user in the layer.
* `restrictions` - The list of restrictions in the layer.
* `start_time_of_day`- The start_time_of_day of the restriction. time in HH:MM:SS format.
* `start_day_of_week` - The start_day_of_week of the restriction. for daily restriction, it is 7. for weekly restriction, it is the day of the week.ie: 1 for monday, 2 for tuesday, 3 for wednesday, 4 for thursday, 5 for friday, 6 for saturday, 7 for sunday.
* `duration` - The duration of the restriction in seconds.for daily restriction, max value can be 86400(24*60*60). for weekly restriction, it is 604800(7*24*60*60).
* `overrides` - The list of overrides in the schedule.
* `name` - The name of the override.
* `start_time` - The start_time of the override. .
* `end_time` - The end_time of the override.
* `user` - The user of the override.




<!-- schema generated by tfplugindocs -->

Expand Down
18 changes: 18 additions & 0 deletions docs/data-sources/zenduty_services.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,24 @@ output "services" {
* `team_id`(Required) - The UniqueID of the team to query.
* `service_id`(Optional) - The UniqueID of the service to query.along with team id

## Attributes Reference

The following attributes are exported as list of maps:

* `name` - The name of the service.
* `description` - The description of the service.
* `summary` - The summary of the service
* `unique_id` - The unique_id of the service.
* `team_id` - The unique_id of the team.
* `escalation_policy` - unique_id escalation policy of the service.
* `collation` - The collation of the service.which specifes collation is enabled or not.
* `collation_time` - The collation time of the service in seconds
* `sla` - Uniqueid of sla associated with the service
* `task_template` - Uniqueid of task template associated with the service
* `team_priority` - Uniqueid of team priority associated with the service
* `under_maintenance` - The under_maintenance of the service.which specifes service is under maintenance or not.





Expand Down
2 changes: 1 addition & 1 deletion docs/data-sources/zenduty_tags.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ data "zenduty_tags" "production_tags" {

```hcl
output "zenduty_tags" {" {
output "zenduty_tags" {
value = data.zenduty_tags.production_tags.tags
}
Expand Down
23 changes: 23 additions & 0 deletions docs/data-sources/zenduty_teams.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,26 @@ output "teams" {
### Optional

- **team_id** (String)

## Attributes Reference

The following attributes are exported as list of maps:

* `name` - The name of the team.
* `unique_id` - The unique_id of the team.
* `account` - The account_id of the team.
* `owner` - The username of the owner of the team.
* `members` - The list of members of the team.
* `team` - The unique_id of the team.
* `role` - The role of the member.
* `user` - contains Maps with attributes
* `username` - The username of the user.
* `first_name` - The first name of the user.
* `last_name` - The last name of the user.
* `email` - The emailid of the user.
* `roles` - The list of Incident roles in the team as maps.
* `team` - The unique_id of the team.
* `title` - The title of the role.
* `description` - The description of the role.
* `rank` - The rank of the role.

47 changes: 47 additions & 0 deletions docs/data-sources/zenduty_usercontact.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
layout: "zenduty"
page_title: "zenduty_usercontact Data Source - terraform-provider-zenduty"
subcategory: ""
description: |-
"`zenduty_usercontact` data source allows you to query contacts of a user."
---

# zenduty_usercontact (Data Source)

```hcl
data "zenduty_user" "user1" {
email = "demouser@gmail.com"
}
```

```hcl
data "zenduty_usercontact" "exampleusercontact" {
user_id = data.zenduty_user.user1.users[0].username
contact_type=1
}
```

```hcl
output "usercontact" {
value = data.zenduty_usercontact.exampleusercontact
}
```

## Argument Reference

* `user_id` (Required) - The username of the user to query.
* `contact_type` (Required) - The contact type of the user to query.
values are `1` Email, `2` SMS, `3` Phone, `4` Slack, `5` MS Teams
* `value` (Optional) - The value of the contact type.

## Attributes Reference

* `id` - Unique ID of the contact.
* `value` - The value of the contact.
* `name` - The name of the contact.

NOTE: If more than one contact is returned, the first one is returned by default.
8 changes: 8 additions & 0 deletions docs/data-sources/zenduty_users.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ output "user" {
## Argument Reference
* `email`(Required) - Emailid of the user to query.

## Attributes Reference
The following attributes are exported as list of maps:

* `email` - The emailid of the user.
* `first_name` - The first name of the user.
* `last_name` - The last name of the user.
* `username` - The username of the user.




Expand Down
55 changes: 51 additions & 4 deletions docs/resources/zenduty_alertrules.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,43 @@
---
page_title: "Zenduty Alert Rules"
subcategory: ""
description: |-
" `zenduty_alertrules` is a resource to manage alert rules in a integration"

---
# zenduty_alertrules (Resource)
`zenduty_alertrules` is a resource to manage alert rules in a integration


## Example Usage

```hcl
resource "zenduty_teams" "exampleteam" {
name = "exmaple team"
}
resource "zenduty_services" "exampleservice" {
name = "example service"
team_id = zenduty_teams.exampleteam.id
escalation_policy = zenduty_esp.example_esp.id e
}
resource "zenduty_integrations" "exampleintegration" {
team_id = zenduty_teams.exampleteam.id
service_id = zenduty_services.exampleservice.id
application = ""
name = "exampleintegration"
summary = "This is the summary for the example integration"
}
```

```hcl
resource "zenduty_alertrules" "example_alertrules" {
description = "This is the description for the new alert rules"
team_id = ""
service_id = ""
integration_id = ""
team_id = zenduty_teams.exampleteam.id
service_id = zenduty_services.exampleservice.id
integration_id = zenduty_integrations.exampleintegration.id
rule_json = ""
#actions
}
Expand All @@ -28,6 +50,7 @@ resource "zenduty_alertrules" "example_alertrules" {
* `service_id` (Required) - The unique_id of the service to create the alert rule in.
* `integration_id` (Required) - The unique_id of the integration to create the alert rule in.
* `description` (Required) - The description of the alert rule.
* `rule_json` (Required)(string) - The rule json of the alert rule.You cannot construct the rule json in terraform as of now.One can construct the rule json in Zenduty's UI.Create an dummy alert rule in Zenduty and copy the rule_json from the UI.
* `actions` (Optional) - The rules of the escalation policy. (see [below for nested schema](#nestedblock--actions))


Expand Down Expand Up @@ -61,6 +84,30 @@ resource "zenduty_alertrules" "example_alertrules" {
* `key` (Optional)(string) - The key of the action. (required for `11`)


## Attributes Reference

The following attributes are exported:

* `id` - The ID of the Alert Rule.

## Import

Integrations can be imported using the `team_id`(ie. unique_id of the team), `service_id`(ie. unique_id of the service),`integration_id`(ie. unique_id of the integration) and `alertrule_id`(ie. unique_id of the alert rule).

```hcl
resource "zenduty_alertrules" "rule1" {
}
```

`$ terraform import zenduty_alertrules.rule1 team_id/service_id/integration_id/alertrule_id`

`$ terraform state show zenduty_alertrules.rule1`

`* copy the output data and paste inside zenduty_alertrules.rule1 resource block and remove the id attribute`

`$ terraform plan` to verify the import



Expand Down
Loading

0 comments on commit ffebdbf

Please sign in to comment.