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

New Resource: integration_jira #146

Merged
merged 1 commit into from
Jul 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions docs/resources/integration_jira.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "wiz_integration_jira Resource - terraform-provider-wiz"
subcategory: ""
description: |-
Integrations are reusable, generic connections between Wiz and third-party platforms like Slack, Google Chat, and Jira that allow data from Wiz to be passed to your preferred tool.
---

# wiz_integration_jira (Resource)

Integrations are reusable, generic connections between Wiz and third-party platforms like Slack, Google Chat, and Jira that allow data from Wiz to be passed to your preferred tool.

## Example Usage

```terraform
resource "wiz_integration_jira" "default" {
name = "default"
jira_url = var.jira_url
jira_username = var.jira_username
jira_password = var.jira_password
scope = "All Resources, Restrict this Integration to global roles only"
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `jira_url` (String) Jira URL. (default: none, environment variable: WIZ_INTEGRATION_JIRA_URL)
- `name` (String) The name of the integration.

### Optional

- `jira_allow_insecure_tls` (Boolean) Jira integration TLS setting
- `jira_client_certificate_and_private_key` (String, Sensitive) Jira PEM with client certificate and private key
- `jira_is_on_prem` (Boolean) Whether Jira instance is on prem
- Defaults to `false`.
- `jira_password` (String, Sensitive) Jira password. (default: none, environment variable: WIZ_INTEGRATION_JIRA_PASSWORD)
- `jira_pat` (String, Sensitive) Jira personal access token (used for on-prem). (default: none, environment variable: WIZ_INTEGRATION_JIRA_PAT)
- `jira_server_ca` (String) Jira server CA
- `jira_server_type` (String) Jira server type
- Defaults to `CLOUD`.
- `jira_username` (String) Email of a Jira user with permissions to create tickets. (default: none, environment variable: WIZ_INTEGRATION_JIRA_USERNAME)
- `project_id` (String) The project this action is scoped to.
- `scope` (String) Scoping to a selected Project makes this Integration accessible only to users with global roles or Project-scoped access to the selected Project. Other users will not be able to see it, use it, or view its results. Integrations restricted to global roles cannot be seen or used by users with Project-scoped roles.
- Allowed values:
- Selected Project
- All Resources
- All Resources, Restrict this Integration to global roles only

- Defaults to `All Resources, Restrict this Integration to global roles only`.

### Read-Only

- `created_at` (String) Identifies the date and time when the object was created.
- `id` (String) Identifier for this object.
7 changes: 7 additions & 0 deletions examples/resources/wiz_integration_jira/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
resource "wiz_integration_jira" "default" {
name = "default"
jira_url = var.jira_url
jira_username = var.jira_username
jira_password = var.jira_password
scope = "All Resources, Restrict this Integration to global roles only"
}
2 changes: 2 additions & 0 deletions internal/acceptance/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ const (
TcUser TestCase = "USER"
// TcServiceNow test case
TcServiceNow TestCase = "SERVICE_NOW"
// TcJira test case
TcJira TestCase = "JIRA"
// TcSubscriptionResourceGroups test case
TcSubscriptionResourceGroups TestCase = "SUBSCRIPTION_RESOURCE_GROUPS"
)
2 changes: 2 additions & 0 deletions internal/acceptance/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ func testAccPreCheck(t *testing.T, tc TestCase) {
envVars = append(commonEnvVars, "WIZ_SMTP_DOMAIN")
case TcServiceNow:
envVars = append(commonEnvVars, "WIZ_INTEGRATION_SERVICENOW_URL", "WIZ_INTEGRATION_SERVICENOW_USERNAME", "WIZ_INTEGRATION_SERVICENOW_PASSWORD")
case TcJira:
envVars = append(commonEnvVars, "WIZ_INTEGRATION_JIRA_URL", "WIZ_INTEGRATION_JIRA_USERNAME", "WIZ_INTEGRATION_JIRA_PASSWORD", "WIZ_INTEGRATION_JIRA_PROJECT")
case TcSubscriptionResourceGroups:
envVars = append(commonEnvVars, "WIZ_SUBSCRIPTION_ID")
default:
Expand Down
55 changes: 55 additions & 0 deletions internal/acceptance/resource_integration_jira_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package acceptance

import (
"fmt"
"os"
"testing"

"github.com/hashicorp/terraform-plugin-testing/helper/acctest"
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
)

func TestAccResourceWizIntegrationJira_basic(t *testing.T) {
rName := acctest.RandomWithPrefix(ResourcePrefix)

resource.UnitTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t, TcJira) },
ProviderFactories: providerFactories,
Steps: []resource.TestStep{
{
Config: testResourceWizIntegrationJiraBasic(rName),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr(
"wiz_integration_jira.foo",
"name",
rName,
),
resource.TestCheckResourceAttr(
"wiz_integration_jira.foo",
"jira_url",
os.Getenv("WIZ_INTEGRATION_JIRA_URL"),
),
resource.TestCheckResourceAttr(
"wiz_integration_jira.foo",
"jira_username",
os.Getenv("WIZ_INTEGRATION_JIRA_USERNAME"),
),
resource.TestCheckResourceAttr(
"wiz_integration_jira.foo",
"scope",
"All Resources, Restrict this Integration to global roles only",
),
),
},
},
})
}

func testResourceWizIntegrationJiraBasic(rName string) string {
return fmt.Sprintf(`
resource "wiz_integration_jira" "foo" {
name = "%s"
scope = "All Resources, Restrict this Integration to global roles only"
}
`, rName)
}
1 change: 1 addition & 0 deletions internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ yLyKQXhw2W2Xs0qLeC1etA+jTGDK4UfLeC0SF7FSi8o5LL21L8IzApar2pR/
"wiz_host_config_rule_associations": resourceWizHostConfigRuleAssociations(),
"wiz_integration_aws_sns": resourceWizIntegrationAwsSNS(),
"wiz_integration_servicenow": resourceWizIntegrationServiceNow(),
"wiz_integration_jira": resourceWizIntegrationJira(),
"wiz_project": resourceWizProject(),
"wiz_saml_idp": resourceWizSAMLIdP(),
"wiz_security_framework": resourceWizSecurityFramework(),
Expand Down
Loading