Skip to content

Commit

Permalink
Merge pull request #14 from dheeruk12/main
Browse files Browse the repository at this point in the history
What's new in this release:

1.Added GlobalEventRouter, GlobalEventRoutingRules
2.Added Custom Roles
3.Updated zenduty-go-sdk v0.1.7
4.Code refactor for improved maintainability.
  • Loading branch information
vishwa306 authored May 11, 2023
2 parents 6f62266 + 648bcad commit 530ded0
Show file tree
Hide file tree
Showing 43 changed files with 1,522 additions and 770 deletions.
76 changes: 76 additions & 0 deletions docs/resources/zenduty_account_role.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "Zenduty: CustomRole"
subcategory: ""
description: |-
Provides a Zenduty CustomRole Resource. This allows CustomRole(rbac) to be created, updated, deleted.
---

# Resource : zenduty_account_role

Provides a Zenduty CustomRole Resource. This allows CustomRole(rbac) to be created, updated, deleted.


## Example Usage
```hcl
resource "zenduty_account_role" "sre" {
description = "view all incidents in account"
name = "sre"
permissions = [
"incident_read",
]
}
```


<!-- schema generated by tfplugindocs -->
## Argument Reference

* `name` (Required) - Name of the CustomRoke
* `description` (Required) -
* `permissions` (Required) - List of permissions this role is granted

### Permissions

Please refer to the following link for detailed documentation https://docs.zenduty.com/rbac

- "analytics_read",
- "escalation_policy_read",
- "escalation_policy_write",
- "incident_read",
- "incident_write",
- "incident_role_read",
- "incident_role_write",
- "integration_read",
- "integration_write",
- "maintenance_read",
- "maintenance_write",
- "member_read",
- "member_write",
- "postmortem_read",
- "postmortem_write",
- "priority_read",
- "priority_write",
- "schedule_read",
- "schedule_write",
- "service_read",
- "service_write",
- "sla_read",
- "sla_write",
- "stakeholder_template_read",
- "stakeholder_template_write",
- "tag_read",
- "tag_write",
- "task_template_read",
- "task_template_write",
- "team_read",


## Attributes Reference

The following attributes are exported:

* `id` - The UniqueID of the Zenduty Account Role.


2 changes: 1 addition & 1 deletion docs/resources/zenduty_alertrules.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ resource "zenduty_alertrules" "example_alertrules" {
* `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))
* `actions` (Optional) - The actions to be performed when the rule matches. (see [below for nested schema](#nestedblock--actions))


<a id="nestedblock--actions"></a>
Expand Down
42 changes: 42 additions & 0 deletions docs/resources/zenduty_assign_account_role.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "Zenduty: AssignAccountRole"
subcategory: ""
description: |-
Provides a Zenduty AssignAccountRole Resource. This allows you to assign role to user
---

# Resource : zenduty_assign_account_role

This Resource allows you to assign a custom role to user

---

## Example Usage
```hcl
resource "zenduty_account_role" "sre" {
description = "view all incidents in account"
name = "sre"
permissions = [
"incident_read",
]
}
data "zenduty_user" "user1" {
email = "[email protected]"
}
resource "zenduty_assign_account_role" "demouser" {
username = data.zenduty_user.user1.users[0].username
account_role = zenduty_account_role.sre.id
}
```


<!-- schema generated by tfplugindocs -->
## Argument Reference

* `username` (Required) - Username of the User
* `account_role`(Required) - UniqueID of the AccountRole
58 changes: 58 additions & 0 deletions docs/resources/zenduty_globalrouter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "Zenduty: GlobalRouter"
subcategory: ""
description: |-
Provides a Zenduty GlobalRouter Resource. This allows you to users to create a Router.which allows you to route alerts based on the rules
---

# Resource : zenduty_globalrouter

An Global Router allows users to create a Router. The Router evaluates events sent to this Router against each of its rules, one at a time, and routes the event to a specific Integration based on the first rule that matches.

---

## Example Usage
```hcl
resource "zenduty_globalrouter" "router" {
name = "demorouter"
description = "This is a demo router"
}
```


<!-- schema generated by tfplugindocs -->
## Argument Reference

* `name` (Required) - Name of the Router
* `description`(Required) - Description of the Router
* `is_optional` (Optional) - Enable or Disable the router

## Attributes Reference

The following attributes are exported:

* `id` - The ID of the GlobalRouter.
* `integration_key` - The integration key of the GlobalRouter.


## Import

GlobalRouter can be imported using the `router_id`(ie. UniqueID of the router), e.g.

```hcl
resource "zenduty_globalrouter" "router" {
}
```

`$ terraform import zenduty_globalrouter.router router_id`

`$ terraform state show zenduty_globalrouter.router`

`copy the output data and paste inside zenduty_globalrouter.router resource block and remove the id,integration_key attribute`

`$ terraform plan` to verify the import
76 changes: 76 additions & 0 deletions docs/resources/zenduty_globalrouting_rule.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "Zenduty: GlobalRoutingRule"
subcategory: ""
description: |-
Provides a Zenduty GlobalRoutingRule Resource. This allows you to users to create routing rules.which allows you to route alerts based on the rules
---

# Resource : zenduty_globalrouting_rule

An Global Router allows users to create routing rules. The Router evaluates events sent to this Router against each of its rules, one at a time, and routes the event to a specific Integration based on the first rule that matches.

---

## Example Usage
```hcl
resource "zenduty_globalrouter" "router" {
name = "demorouter"
description = "This is a demo router"
}
resource "zenduty_globalrouting_rule" "demorules" {
router_id = zenduty_globalrouter.router.id
name = "demorule"
rule_json = ""
actions {
action_type = 0
integration = "unique_id of integration"
}
}
resource "zenduty_globalrouting_rule" "supressrule" {
router_id = zenduty_globalrouter.router.id
name = "supress"
rule_json = ""
actions {
action_type = 1
}
}
```


<!-- schema generated by tfplugindocs -->
## Argument Reference

* `name` (Required) - Name of the Routing Rule
* `router_id` - UniqueID of the GlobalRouter
* `rule_json` (Required)(string) - The rule json of the routing 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 actions to be performed when the rule matches.values are `0` route to integration `1` supress the alert

## Attributes Reference

The following attributes are exported:

* `id` - The ID of the GlobalRouterRule.


## Import

GlobalRouterRule can be imported using the `router_id/rule_id`(ie. UniqueID of the router,rule), e.g.

```hcl
resource "zenduty_globalrouting_rule" "rule1" {
}
```

`$ terraform import zenduty_globalrouting_rule.rule1 router_id/rule_id`

`$ terraform state show zenduty_globalrouting_rule.rule1`

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

`$ terraform plan` to verify the import
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module terraform-provider-zenduty
go 1.17

require (
github.com/Zenduty/zenduty-go-sdk v0.1.5
github.com/Zenduty/zenduty-go-sdk v0.1.7
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
github.com/hashicorp/terraform-plugin-sdk/v2 v2.10.1
)
Expand Down
Loading

0 comments on commit 530ded0

Please sign in to comment.