diff --git a/docs/data-sources/field.md b/docs/data-sources/field.md new file mode 100644 index 00000000..481b3914 --- /dev/null +++ b/docs/data-sources/field.md @@ -0,0 +1,46 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "jira_field Data Source - terraform-provider-jira" +subcategory: "" +description: |- + +--- + +# jira_field (Data Source) + + + +## Example Usage + +```terraform +data "jira_field" "epic_link" { + name = "Epic Link" +} + +resource "jira_issue" "custom_fields_example" { + issue_type = "Task" + summary = "Also Created using Terraform" + fields = { + (jira_field.epic_link.id) = jira_issue.example_epic.issue_key + } + project_key = "PROJ" +} +``` + + +## Schema + +### Required + +- `name` (String) + +### Read-Only + +- `clause_names` (List of String) +- `custom` (Boolean) +- `id` (String) The ID of this resource. +- `key` (String) +- `navigable` (Boolean) +- `searchable` (Boolean) + + diff --git a/docs/data-sources/jql.md b/docs/data-sources/jql.md new file mode 100644 index 00000000..024c1328 --- /dev/null +++ b/docs/data-sources/jql.md @@ -0,0 +1,33 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "jira_jql Data Source - terraform-provider-jira" +subcategory: "" +description: |- + +--- + +# jira_jql (Data Source) + + + +## Example Usage + +```terraform +data "jira_jql" "issues" { + jql = "project = TRF ORDER BY key ASC" +} +``` + + +## Schema + +### Required + +- `jql` (String) + +### Read-Only + +- `id` (String) The ID of this resource. +- `issue_keys` (List of String) + + diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 00000000..36f71069 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,56 @@ +--- +page_title: "Provider: JIRA" +description: |- + Terraform Provider for managing JIRA. +--- + +# JIRA Provider + +Working in Operations engineering organizations infrastructure is often driven by tickets. +Why not track infrastructure using tickets but this time we will use code. + +## Example Usage + +Set JIRA URL, Username and Password using environment variables + +```bash +export JIRA_URL=http://localhost:8080 +export JIRA_USER=username +export JIRA_PASSWORD=password +``` + +If you prefer Personal Access Tokens + +```bash +export JIRA_URL=http://localhost:8080 +export JIRA_TOKEN= +``` + + +It's also possible to use an API-Token from JIRA cloud. In this case, set + +```bash +export JIRA_URL=https://yourinstance.atlassian.net +export JIRA_USER=username@example.org +export JIRA_PASSWORD= +``` + +```terraform +provider "jira" { + url = "https://myjira.atlassian.net" # Can also be set using the JIRA_URL environment variable + user = "xxxx" # Can also be set using the JIRA_USER environment variable + password = "xxxx" # Can also be set using the JIRA_PASSWORD environment variable + token = "xxxx" # Can also be set using the JIRA_TOKEN environment variable +} +``` + + + +## Schema + +### Optional + +- `password` (String, Sensitive) Password for the user, can also be an API Token. Can be specified with the JIRA_PASSWORD environment variable. +- `token` (String, Sensitive) Personal access token of a user. Can be specified with the JIRA_TOKEN environment variable. +- `url` (String) URL for your Jira instance. Can be specified with the JIRA_URL environment variable. +- `user` (String) Username for your user. Can be specified with the JIRA_USER environment variable. diff --git a/docs/resources/comment.md b/docs/resources/comment.md new file mode 100644 index 00000000..bb5df7d2 --- /dev/null +++ b/docs/resources/comment.md @@ -0,0 +1,40 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "jira_comment Resource - terraform-provider-jira" +subcategory: "" +description: |- + Creates a comment for an issue +--- + +# jira_comment (Resource) + +Creates a comment for an issue + +## Example Usage + +```terraform +resource "jira_issue" "example" { + issue_type = "${jira_issue_type.task.name}" + project_key = "PROJ" + summary = "Created using Terraform" +} + +resource "jira_comment" "example_comment" { + body = "Commented using terraform" + issue_key = "${jira_issue.example.issue_key}" +} +``` + + +## Schema + +### Required + +- `body` (String) The contents of the comment to be created +- `issue_key` (String) + +### Read-Only + +- `id` (String) The ID of this resource. + + diff --git a/docs/resources/component.md b/docs/resources/component.md new file mode 100644 index 00000000..c31c85ac --- /dev/null +++ b/docs/resources/component.md @@ -0,0 +1,41 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "jira_component Resource - terraform-provider-jira" +subcategory: "" +description: |- + Creates a project component +--- + +# jira_component (Resource) + +Creates a project component + +## Example Usage + +```terraform +resource "jira_component" "example_component" { + name = "Sample Component" + project_key = "PRJ" + description = "Sample Description" +} +``` + + +## Schema + +### Required + +- `name` (String) Name of the component +- `project_key` (String) Project Key (for example PRJ) + +### Optional + +- `assignee_type` (String) Default assignee type. Can be one of project_default, component_lead, project_lead or unassigned. +- `description` (String) Description of the component +- `lead` (String) Component lead + +### Read-Only + +- `id` (String) The ID of this resource. + + diff --git a/docs/resources/filter.md b/docs/resources/filter.md new file mode 100644 index 00000000..28d3189d --- /dev/null +++ b/docs/resources/filter.md @@ -0,0 +1,78 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "jira_filter Resource - terraform-provider-jira" +subcategory: "" +description: |- + +--- + +# jira_filter (Resource) + + + +## Example Usage + +```terraform +resource "jira_filter" "filter" { + name = "Simple Filter" + jql = "project = PROJ" + + // Optional Fields + description = "All Issues in PROJ" + favourite = false + + // All Members of project with ID 13102 + permissions { + type = "project" + project_id = "13102" + } + + // All Members of Group "Team A" + permissions { + type = "group" + group_name = "Team A" + } + + // Any authenticated user + permissions { + type = "authenticated" + } +} +``` + + +## Schema + +### Required + +- `jql` (String) JQL expression of the filter +- `name` (String) Name of the filter + +### Optional + +- `description` (String) Description of the filter +- `favourite` (Boolean) Whether the filter is marked as favorite +- `permissions` (Block Set) Filter permissions (see [below for nested schema](#nestedblock--permissions)) + +### Read-Only + +- `id` (String) The ID of this resource. + + +### Nested Schema for `permissions` + +Required: + +- `type` (String) Type of the permission. Needs to be one of global, group, project, project_role or authenticated + +Optional: + +- `group_name` (String) All Members of the of this group can access the filter +- `project_id` (String) All Members of the project with the given ID can access the filter +- `project_role_id` (String) + +Read-Only: + +- `id` (String) The ID of this resource. + + diff --git a/docs/resources/group.md b/docs/resources/group.md new file mode 100644 index 00000000..76fc1bf7 --- /dev/null +++ b/docs/resources/group.md @@ -0,0 +1,33 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "jira_group Resource - terraform-provider-jira" +subcategory: "" +description: |- + +--- + +# jira_group (Resource) + + + +## Example Usage + +```terraform +// Create a group named "Terraform Managed" +resource "jira_group" "tf_group" { + name = "Terraform Managed" +} +``` + + +## Schema + +### Required + +- `name` (String) + +### Read-Only + +- `id` (String) The ID of this resource. + + diff --git a/docs/resources/group_membership.md b/docs/resources/group_membership.md new file mode 100644 index 00000000..88d087b4 --- /dev/null +++ b/docs/resources/group_membership.md @@ -0,0 +1,40 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "jira_group_membership Resource - terraform-provider-jira" +subcategory: "" +description: |- + +--- + +# jira_group_membership (Resource) + + + +## Example Usage + +```terraform +// Create a group named "Terraform Managed" +resource "jira_group" "tf_group" { + name = "Terraform Managed" +} + +// User "bot" will be a Member of "Terraform Managed" +resource "jira_group_membership" "gm_1" { + username = "bot" + group = "${jira_group.tf_group.name}" +} +``` + + +## Schema + +### Required + +- `group` (String) +- `username` (String) + +### Read-Only + +- `id` (String) The ID of this resource. + + diff --git a/docs/resources/issue.md b/docs/resources/issue.md new file mode 100644 index 00000000..81a0a4ca --- /dev/null +++ b/docs/resources/issue.md @@ -0,0 +1,72 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "jira_issue Resource - terraform-provider-jira" +subcategory: "" +description: |- + +--- + +# jira_issue (Resource) + + + +## Example Usage + +```terraform +resource "jira_issue" "example" { + issue_type = "Task" + project_key = "PROJ" + summary = "Created using Terraform" + + // description is optional + description = "This is a test issue" + + // (optional) Instead of deleting the issue, perform this transition + delete_transition = 21 + + // (optional) Make sure, the issue is in the desired state + // using state_transition + state = 10000 + state_transition = 31 +} + +data "jira_field" "epic_link" { + name = "Epic Link" +} + +resource "jira_issue" "custom_fields_example" { + issue_type = "Task" + summary = "Also Created using Terraform" + fields = { + (jira_field.epic_link.id) = jira_issue.example_epic.issue_key + } + project_key = "PROJ" +} +``` + + +## Schema + +### Required + +- `issue_type` (String) +- `project_key` (String) +- `summary` (String) + +### Optional + +- `assignee` (String) +- `delete_transition` (String) +- `description` (String) +- `fields` (Map of String) +- `labels` (List of String) +- `reporter` (String) +- `state` (String) +- `state_transition` (String) + +### Read-Only + +- `id` (String) The ID of this resource. +- `issue_key` (String) + + diff --git a/docs/resources/issue_link.md b/docs/resources/issue_link.md new file mode 100644 index 00000000..2f925a7e --- /dev/null +++ b/docs/resources/issue_link.md @@ -0,0 +1,36 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "jira_issue_link Resource - terraform-provider-jira" +subcategory: "" +description: |- + +--- + +# jira_issue_link (Resource) + + + +## Example Usage + +```terraform +resource "jira_issue_link_type" "blocks" { + name = "Blocks" + inward = "is blocked by" + outward = "blocks" +} +``` + + +## Schema + +### Required + +- `inward_key` (String) +- `link_type` (String) +- `outward_key` (String) + +### Read-Only + +- `id` (String) The ID of this resource. + + diff --git a/docs/resources/issue_link_type.md b/docs/resources/issue_link_type.md new file mode 100644 index 00000000..e7706529 --- /dev/null +++ b/docs/resources/issue_link_type.md @@ -0,0 +1,54 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "jira_issue_link_type Resource - terraform-provider-jira" +subcategory: "" +description: |- + +--- + +# jira_issue_link_type (Resource) + + + +## Example Usage + +```terraform +resource "jira_issue" "example" { + issue_type = "Task" + project_key = "PROJ" + summary = "Created using Terraform" +} + +resource "jira_issue" "another_example" { + issue_type = "Task" + project_key = "PROJ" + summary = "Created using Terraform" +} + +resource "jira_issue_link_type" "blocks" { + name = "Blocks" + inward = "is blocked by" + outward = "blocks" +} + +resource "jira_issue_link" "linked" { + inward_key = "${jira_issue.example.issue_key}" + outward_key = "${jira_issue.another_example.issue_key}" + link_type = "${jira_issue_link_type.blocks.id}" +} +``` + + +## Schema + +### Required + +- `inward` (String) +- `name` (String) +- `outward` (String) + +### Read-Only + +- `id` (String) The ID of this resource. + + diff --git a/docs/resources/issue_type.md b/docs/resources/issue_type.md new file mode 100644 index 00000000..52680f50 --- /dev/null +++ b/docs/resources/issue_type.md @@ -0,0 +1,41 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "jira_issue_type Resource - terraform-provider-jira" +subcategory: "" +description: |- + +--- + +# jira_issue_type (Resource) + + + +## Example Usage + +```terraform +// The types will be globally available in JIRA +resource "jira_issue_type" "task" { + description = "A Task." + name = "Task" + avatar_id = 10318 +} +``` + + +## Schema + +### Required + +- `name` (String) + +### Optional + +- `avatar_id` (Number) +- `description` (String) +- `is_subtask` (Boolean) + +### Read-Only + +- `id` (String) The ID of this resource. + + diff --git a/docs/resources/project.md b/docs/resources/project.md new file mode 100644 index 00000000..106026c3 --- /dev/null +++ b/docs/resources/project.md @@ -0,0 +1,73 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "jira_project Resource - terraform-provider-jira" +subcategory: "" +description: |- + +--- + +# jira_project (Resource) + + + +## Example Usage + +```terraform +resource "jira_project_category" "category" { + name = "Managed" + description = "Managed Projects" +} + +resource "jira_project" "project_a" { + key = "TRF" + name = "Terraform" + project_type_key = "business" + project_template_key = "com.atlassian.jira-core-project-templates:jira-core-project-management" + lead = "bot" + // For JIRA Cloud use lead_account_id instead + lead_account_id = "xxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" + permission_scheme = 10400 + notification_scheme = 10300 + category_id = "${jira_project_category.category.id}" +} + + +// Create a Project with a shared configuration +resource "jira_project" "project_shared" { + key = "SHARED" + name = "Project (with shared config)" + lead = "bot" + shared_configuration_project_id = "${jira_project.project_a.project_id}" +} +``` + + +## Schema + +### Required + +- `key` (String) +- `name` (String) + +### Optional + +- `assignee_type` (String) +- `avatar_id` (Number) +- `category_id` (String) +- `description` (String) +- `issue_security_scheme` (Number) +- `lead` (String) +- `lead_account_id` (String) +- `notification_scheme` (Number) +- `permission_scheme` (Number) +- `project_template_key` (String) +- `project_type_key` (String) +- `shared_configuration_project_id` (Number) +- `url` (String) + +### Read-Only + +- `id` (String) The ID of this resource. +- `project_id` (Number) + + diff --git a/docs/resources/project_category.md b/docs/resources/project_category.md new file mode 100644 index 00000000..e1162652 --- /dev/null +++ b/docs/resources/project_category.md @@ -0,0 +1,37 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "jira_project_category Resource - terraform-provider-jira" +subcategory: "" +description: |- + +--- + +# jira_project_category (Resource) + + + +## Example Usage + +```terraform +resource "jira_project_category" "category" { + name = "Managed" + description = "Managed Projects" +} +``` + + +## Schema + +### Required + +- `name` (String) + +### Optional + +- `description` (String) + +### Read-Only + +- `id` (String) The ID of this resource. + + diff --git a/docs/resources/project_membership.md b/docs/resources/project_membership.md new file mode 100644 index 00000000..0f4edab3 --- /dev/null +++ b/docs/resources/project_membership.md @@ -0,0 +1,57 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "jira_project_membership Resource - terraform-provider-jira" +subcategory: "" +description: |- + +--- + +# jira_project_membership (Resource) + + + +## Example Usage + +```terraform +resource "jira_role" "role" { + name = "Project Manager" + description = "The Project Managers" +} + +resource "jira_group" "tf_group" { + name = "Terraform Managed" +} + +// Grant Project Access to user "bot" +resource "jira_project_membership" "member" { + project_key = "TRF" + role_id = "${jira_role.role.id}" + username = "bot" +} + +// Grant Project Access to group "bot" +resource "jira_project_membership" "group_member" { + project_key = "TRF" + role_id = "${jira_role.role.id}" + group = "${jira_group.tf_group.name}" +} +``` + + +## Schema + +### Required + +- `project_key` (String) +- `role_id` (Number) + +### Optional + +- `group` (String) +- `username` (String) + +### Read-Only + +- `id` (String) The ID of this resource. + + diff --git a/docs/resources/role.md b/docs/resources/role.md new file mode 100644 index 00000000..5a397c23 --- /dev/null +++ b/docs/resources/role.md @@ -0,0 +1,37 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "jira_role Resource - terraform-provider-jira" +subcategory: "" +description: |- + +--- + +# jira_role (Resource) + + + +## Example Usage + +```terraform +resource "jira_role" "role" { + name = "Project Manager" + description = "The Project Managers" +} +``` + + +## Schema + +### Required + +- `name` (String) + +### Optional + +- `description` (String) + +### Read-Only + +- `id` (String) The ID of this resource. + + diff --git a/docs/resources/user.md b/docs/resources/user.md new file mode 100644 index 00000000..6177c54f --- /dev/null +++ b/docs/resources/user.md @@ -0,0 +1,39 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "jira_user Resource - terraform-provider-jira" +subcategory: "" +description: |- + +--- + +# jira_user (Resource) + + + +## Example Usage + +```terraform +resource "jira_user" "demo_user" { + name = "bot" + email = "bot@example.org" + display_name = "The Bot" +} +``` + + +## Schema + +### Required + +- `email` (String) +- `name` (String) + +### Optional + +- `display_name` (String) + +### Read-Only + +- `id` (String) The ID of this resource. + + diff --git a/docs/resources/webhook.md b/docs/resources/webhook.md new file mode 100644 index 00000000..021d6c05 --- /dev/null +++ b/docs/resources/webhook.md @@ -0,0 +1,44 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "jira_webhook Resource - terraform-provider-jira" +subcategory: "" +description: |- + +--- + +# jira_webhook (Resource) + + + +## Example Usage + +```terraform +resource "jira_webhook" "demo_hook" { + name = "Terraform Hook" + url = "https://demohook" + jql = "project = PROJ" + + // See https://developer.atlassian.com/server/jira/platform/webhooks/ for supported events + events = ["jira:issue_created"] +} +``` + + +## Schema + +### Required + +- `name` (String) +- `url` (String) + +### Optional + +- `events` (List of String) +- `exclude_body` (Boolean) +- `jql` (String) + +### Read-Only + +- `id` (String) The ID of this resource. + + diff --git a/examples/data-sources/jira_field/data-source.tf b/examples/data-sources/jira_field/data-source.tf new file mode 100644 index 00000000..3506c996 --- /dev/null +++ b/examples/data-sources/jira_field/data-source.tf @@ -0,0 +1,12 @@ +data "jira_field" "epic_link" { + name = "Epic Link" +} + +resource "jira_issue" "custom_fields_example" { + issue_type = "Task" + summary = "Also Created using Terraform" + fields = { + (jira_field.epic_link.id) = jira_issue.example_epic.issue_key + } + project_key = "PROJ" +} diff --git a/examples/data-sources/jira_jql/data-source.tf b/examples/data-sources/jira_jql/data-source.tf new file mode 100644 index 00000000..e16fe3d2 --- /dev/null +++ b/examples/data-sources/jira_jql/data-source.tf @@ -0,0 +1,3 @@ +data "jira_jql" "issues" { + jql = "project = TRF ORDER BY key ASC" +} diff --git a/examples/provider/provider.tf b/examples/provider/provider.tf new file mode 100644 index 00000000..f894c393 --- /dev/null +++ b/examples/provider/provider.tf @@ -0,0 +1,6 @@ +provider "jira" { + url = "https://myjira.atlassian.net" # Can also be set using the JIRA_URL environment variable + user = "xxxx" # Can also be set using the JIRA_USER environment variable + password = "xxxx" # Can also be set using the JIRA_PASSWORD environment variable + token = "xxxx" # Can also be set using the JIRA_TOKEN environment variable +} diff --git a/examples/resources/jira_comment/resource.tf b/examples/resources/jira_comment/resource.tf new file mode 100644 index 00000000..d60f6f6e --- /dev/null +++ b/examples/resources/jira_comment/resource.tf @@ -0,0 +1,10 @@ +resource "jira_issue" "example" { + issue_type = "${jira_issue_type.task.name}" + project_key = "PROJ" + summary = "Created using Terraform" +} + +resource "jira_comment" "example_comment" { + body = "Commented using terraform" + issue_key = "${jira_issue.example.issue_key}" +} diff --git a/examples/resources/jira_component/resource.tf b/examples/resources/jira_component/resource.tf new file mode 100644 index 00000000..65a80f61 --- /dev/null +++ b/examples/resources/jira_component/resource.tf @@ -0,0 +1,6 @@ + +resource "jira_component" "example_component" { + name = "Sample Component" + project_key = "PRJ" + description = "Sample Description" +} diff --git a/examples/resources/jira_filter/resource.tf b/examples/resources/jira_filter/resource.tf new file mode 100644 index 00000000..cf63b8df --- /dev/null +++ b/examples/resources/jira_filter/resource.tf @@ -0,0 +1,25 @@ +resource "jira_filter" "filter" { + name = "Simple Filter" + jql = "project = PROJ" + + // Optional Fields + description = "All Issues in PROJ" + favourite = false + + // All Members of project with ID 13102 + permissions { + type = "project" + project_id = "13102" + } + + // All Members of Group "Team A" + permissions { + type = "group" + group_name = "Team A" + } + + // Any authenticated user + permissions { + type = "authenticated" + } +} diff --git a/examples/resources/jira_group/resource.tf b/examples/resources/jira_group/resource.tf new file mode 100644 index 00000000..6eb957d3 --- /dev/null +++ b/examples/resources/jira_group/resource.tf @@ -0,0 +1,4 @@ +// Create a group named "Terraform Managed" +resource "jira_group" "tf_group" { + name = "Terraform Managed" +} diff --git a/examples/resources/jira_group_membership/resource.tf b/examples/resources/jira_group_membership/resource.tf new file mode 100644 index 00000000..aed5f03a --- /dev/null +++ b/examples/resources/jira_group_membership/resource.tf @@ -0,0 +1,10 @@ +// Create a group named "Terraform Managed" +resource "jira_group" "tf_group" { + name = "Terraform Managed" +} + +// User "bot" will be a Member of "Terraform Managed" +resource "jira_group_membership" "gm_1" { + username = "bot" + group = "${jira_group.tf_group.name}" +} diff --git a/examples/resources/jira_issue/resource.tf b/examples/resources/jira_issue/resource.tf new file mode 100644 index 00000000..ad9c27eb --- /dev/null +++ b/examples/resources/jira_issue/resource.tf @@ -0,0 +1,30 @@ +resource "jira_issue" "example" { + issue_type = "Task" + project_key = "PROJ" + summary = "Created using Terraform" + + // description is optional + description = "This is a test issue" + + // (optional) Instead of deleting the issue, perform this transition + delete_transition = 21 + + // (optional) Make sure, the issue is in the desired state + // using state_transition + state = 10000 + state_transition = 31 +} + +data "jira_field" "epic_link" { + name = "Epic Link" +} + +resource "jira_issue" "custom_fields_example" { + issue_type = "Task" + summary = "Also Created using Terraform" + fields = { + (jira_field.epic_link.id) = jira_issue.example_epic.issue_key + } + project_key = "PROJ" +} + diff --git a/examples/resources/jira_issue_link/resource.tf b/examples/resources/jira_issue_link/resource.tf new file mode 100644 index 00000000..75a39e64 --- /dev/null +++ b/examples/resources/jira_issue_link/resource.tf @@ -0,0 +1,5 @@ +resource "jira_issue_link_type" "blocks" { + name = "Blocks" + inward = "is blocked by" + outward = "blocks" +} diff --git a/examples/resources/jira_issue_link_type/resource.tf b/examples/resources/jira_issue_link_type/resource.tf new file mode 100644 index 00000000..b1d74bbd --- /dev/null +++ b/examples/resources/jira_issue_link_type/resource.tf @@ -0,0 +1,23 @@ +resource "jira_issue" "example" { + issue_type = "Task" + project_key = "PROJ" + summary = "Created using Terraform" +} + +resource "jira_issue" "another_example" { + issue_type = "Task" + project_key = "PROJ" + summary = "Created using Terraform" +} + +resource "jira_issue_link_type" "blocks" { + name = "Blocks" + inward = "is blocked by" + outward = "blocks" +} + +resource "jira_issue_link" "linked" { + inward_key = "${jira_issue.example.issue_key}" + outward_key = "${jira_issue.another_example.issue_key}" + link_type = "${jira_issue_link_type.blocks.id}" +} diff --git a/examples/resources/jira_issue_type/resource.tf b/examples/resources/jira_issue_type/resource.tf new file mode 100644 index 00000000..a972716b --- /dev/null +++ b/examples/resources/jira_issue_type/resource.tf @@ -0,0 +1,6 @@ +// The types will be globally available in JIRA +resource "jira_issue_type" "task" { + description = "A Task." + name = "Task" + avatar_id = 10318 +} diff --git a/examples/resources/jira_project/resource.tf b/examples/resources/jira_project/resource.tf new file mode 100644 index 00000000..bb594e29 --- /dev/null +++ b/examples/resources/jira_project/resource.tf @@ -0,0 +1,26 @@ +resource "jira_project_category" "category" { + name = "Managed" + description = "Managed Projects" +} + +resource "jira_project" "project_a" { + key = "TRF" + name = "Terraform" + project_type_key = "business" + project_template_key = "com.atlassian.jira-core-project-templates:jira-core-project-management" + lead = "bot" + // For JIRA Cloud use lead_account_id instead + lead_account_id = "xxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" + permission_scheme = 10400 + notification_scheme = 10300 + category_id = "${jira_project_category.category.id}" +} + + +// Create a Project with a shared configuration +resource "jira_project" "project_shared" { + key = "SHARED" + name = "Project (with shared config)" + lead = "bot" + shared_configuration_project_id = "${jira_project.project_a.project_id}" +} diff --git a/examples/resources/jira_project_category/resource.tf b/examples/resources/jira_project_category/resource.tf new file mode 100644 index 00000000..d73b7637 --- /dev/null +++ b/examples/resources/jira_project_category/resource.tf @@ -0,0 +1,4 @@ +resource "jira_project_category" "category" { + name = "Managed" + description = "Managed Projects" +} diff --git a/examples/resources/jira_project_membership/resource.tf b/examples/resources/jira_project_membership/resource.tf new file mode 100644 index 00000000..074b96b7 --- /dev/null +++ b/examples/resources/jira_project_membership/resource.tf @@ -0,0 +1,23 @@ + +resource "jira_role" "role" { + name = "Project Manager" + description = "The Project Managers" +} + +resource "jira_group" "tf_group" { + name = "Terraform Managed" +} + +// Grant Project Access to user "bot" +resource "jira_project_membership" "member" { + project_key = "TRF" + role_id = "${jira_role.role.id}" + username = "bot" +} + +// Grant Project Access to group "bot" +resource "jira_project_membership" "group_member" { + project_key = "TRF" + role_id = "${jira_role.role.id}" + group = "${jira_group.tf_group.name}" +} diff --git a/examples/resources/jira_role/resource.tf b/examples/resources/jira_role/resource.tf new file mode 100644 index 00000000..cf9bc864 --- /dev/null +++ b/examples/resources/jira_role/resource.tf @@ -0,0 +1,4 @@ +resource "jira_role" "role" { + name = "Project Manager" + description = "The Project Managers" +} diff --git a/examples/resources/jira_user/resource.tf b/examples/resources/jira_user/resource.tf new file mode 100644 index 00000000..2514469d --- /dev/null +++ b/examples/resources/jira_user/resource.tf @@ -0,0 +1,5 @@ +resource "jira_user" "demo_user" { + name = "bot" + email = "bot@example.org" + display_name = "The Bot" +} diff --git a/examples/resources/jira_webhook/resource.tf b/examples/resources/jira_webhook/resource.tf new file mode 100644 index 00000000..ee6d7105 --- /dev/null +++ b/examples/resources/jira_webhook/resource.tf @@ -0,0 +1,8 @@ +resource "jira_webhook" "demo_hook" { + name = "Terraform Hook" + url = "https://demohook" + jql = "project = PROJ" + + // See https://developer.atlassian.com/server/jira/platform/webhooks/ for supported events + events = ["jira:issue_created"] +} diff --git a/go.mod b/go.mod index 7fa799f8..ab1fa78b 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,7 @@ go 1.13 require ( github.com/andygrunwald/go-jira v1.16.0 + github.com/hashicorp/terraform-plugin-docs v0.13.0 github.com/hashicorp/terraform-plugin-sdk/v2 v2.22.0 github.com/pkg/errors v0.9.1 github.com/trivago/tgo v1.0.7 @@ -12,7 +13,6 @@ require ( require ( github.com/agext/levenshtein v1.2.3 // indirect github.com/google/go-cmp v0.5.9 // indirect - github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-hclog v1.3.0 // indirect github.com/hashicorp/go-plugin v1.4.5 // indirect github.com/hashicorp/yamux v0.1.1 // indirect diff --git a/go.sum b/go.sum index f03d359c..2bddaf5c 100644 --- a/go.sum +++ b/go.sum @@ -59,6 +59,14 @@ cloud.google.com/go/storage v1.22.1/go.mod h1:S8N1cAStu7BOeFfE8KAQzmyyLkK8p/vmRq dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/Masterminds/goutils v1.1.0/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= +github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= +github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= +github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc= +github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= +github.com/Masterminds/sprig/v3 v3.2.0/go.mod h1:tWhwTbUTndesPNeF0C900vKoq283u6zp4APT9vaF3SI= +github.com/Masterminds/sprig/v3 v3.2.2 h1:17jRggJu518dr3QaafizSXOjKYp94wKfABxUmyxvxX8= +github.com/Masterminds/sprig/v3 v3.2.2/go.mod h1:UoaO7Yp8KlPnJIYWTFkMaqPUYKTfGFPhxNuwnnxkKlk= github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= github.com/Microsoft/go-winio v0.4.16 h1:FtSW/jqD+l4ba5iPBj9CODVtgfYAD8w2wS923g/cFDk= github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0= @@ -86,8 +94,13 @@ github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/ github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec= github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6iT90AvPUL1NNfNw= github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo= +github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI= +github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= +github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY= +github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= @@ -136,6 +149,8 @@ github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 h1:BHsljHzVlRcyQhjrss6TZTdY2VfCqZPbv5k3iBFa2ZQ= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= +github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= +github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gliderlabs/ssh v0.2.2 h1:6zsha5zo/TWhRhwqCD3+EarCAgZ2yN28ipRnGPnwkI0= github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= @@ -236,7 +251,9 @@ github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/enterprise-certificate-proxy v0.0.0-20220520183353-fd19c99a87aa/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= github.com/googleapis/enterprise-certificate-proxy v0.1.0/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= @@ -264,6 +281,7 @@ github.com/hashicorp/go-hclog v0.14.1/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39 github.com/hashicorp/go-hclog v1.2.1/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= github.com/hashicorp/go-hclog v1.3.0 h1:G0ACM8Z2WilWgPv3Vdzwm3V0BQu/kSmrkVtpe1fy9do= github.com/hashicorp/go-hclog v1.3.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= +github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= github.com/hashicorp/go-plugin v1.4.4/go.mod h1:viDMjcLJuDui6pXb8U4HVfb8AamCWhHGUjr2IrTF67s= @@ -285,10 +303,13 @@ github.com/hashicorp/hcl/v2 v2.14.0 h1:jX6+Q38Ly9zaAJlAjnFVyeNSNCKKW8D0wvyg7vij5 github.com/hashicorp/hcl/v2 v2.14.0/go.mod h1:e4z5nxYlWNPdDSNYX+ph14EvWYMFm3eP0zIUqPc2jr0= github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= +github.com/hashicorp/terraform-exec v0.17.2/go.mod h1:tuIbsL2l4MlwwIZx9HPM+LOV9vVyEfBYu2GsO1uH3/8= github.com/hashicorp/terraform-exec v0.17.3 h1:MX14Kvnka/oWGmIkyuyvL6POx25ZmKrjlaclkx3eErU= github.com/hashicorp/terraform-exec v0.17.3/go.mod h1:+NELG0EqQekJzhvikkeQsOAZpsw0cv/03rbeQJqscAI= github.com/hashicorp/terraform-json v0.14.0 h1:sh9iZ1Y8IFJLx+xQiKHGud6/TSUCM0N8e17dKDpqV7s= github.com/hashicorp/terraform-json v0.14.0/go.mod h1:5A9HIWPkk4e5aeeXIBbkcOvaZbIYnAIkEyqP2pNSckM= +github.com/hashicorp/terraform-plugin-docs v0.13.0 h1:6e+VIWsVGb6jYJewfzq2ok2smPzZrt1Wlm9koLeKazY= +github.com/hashicorp/terraform-plugin-docs v0.13.0/go.mod h1:W0oCmHAjIlTHBbvtppWHe8fLfZ2BznQbuv8+UD8OucQ= github.com/hashicorp/terraform-plugin-go v0.14.0 h1:ttnSlS8bz3ZPYbMb84DpcPhY4F5DsQtcAS7cHo8uvP4= github.com/hashicorp/terraform-plugin-go v0.14.0/go.mod h1:2nNCBeRLaenyQEi78xrGrs9hMbulveqG/zDMQSvVJTE= github.com/hashicorp/terraform-plugin-log v0.7.0 h1:SDxJUyT8TwN4l5b5/VkiTIaQgY6R+Y2BQ0sRZftGKQs= @@ -303,10 +324,15 @@ github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKe github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= +github.com/huandu/xstrings v1.3.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= +github.com/huandu/xstrings v1.3.2 h1:L18LIDzqlW6xN2rEkpdV8+oL/IXWJ1APd+vsdYy4Wdw= +github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU= +github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= +github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk= +github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4= @@ -319,8 +345,9 @@ github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351/go.mod h1:CT github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= @@ -330,17 +357,22 @@ github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0 github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/matryer/is v1.2.0 h1:92UTHpy8CDwaJ08GqLDzhhuixiBUUD1p3AU6PHddz4A= github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mitchellh/cli v1.1.4 h1:qj8czE26AU4PbiaPXK5uVmMSM+V5BYsFBiM9HhGRLUA= +github.com/mitchellh/cli v1.1.4/go.mod h1:vTLESy5mRhKOs9KDp0/RATawxP1UqBmdrpVRMnpcvKQ= +github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= @@ -354,6 +386,7 @@ github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQ github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= @@ -368,16 +401,29 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/posener/complete v1.2.3 h1:NP0eAhjcjImqslEwo/1hq7gpajME0fTLTezBKDqfXqo= +github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= +github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/russross/blackfriday v1.6.0 h1:KqfZb0pUVN2lYqZUYRddxF4OR8ZMURnJIG5Y3VRLtww= +github.com/russross/blackfriday v1.6.0/go.mod h1:ti0ldHuxg49ri4ksnFxlkCfN+hvslNlmVHqNRXXJNAY= github.com/sebdah/goldie v1.0.0/go.mod h1:jXP4hmWywNEwZzhMuv2ccnqTSFpuq8iyQhtQdkkZBH4= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= +github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= +github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= +github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= +github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -427,11 +473,14 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200414173820-0848c9571904/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220517005047-85d78b3ac167/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 h1:Y/gsMcFOcR+6S6f3YeMKl5g+dZMEWqcz5Czj/GWYbkM= golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -621,6 +670,7 @@ golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220610221304-9f5ed59c137d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220624220833-87e55d714810/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220627191245-f75cf1eec38b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220909162455-aba9fc2a8ff2 h1:wM1k/lXfpc5HdkJJyW9GELpd8ERGdnh8sMGL6Gzq3Ho= @@ -904,9 +954,9 @@ gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRN gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/jira/resource_comment.go b/jira/resource_comment.go index 910905df..839c260f 100644 --- a/jira/resource_comment.go +++ b/jira/resource_comment.go @@ -16,10 +16,13 @@ func resourceComment() *schema.Resource { Update: resourceCommentUpdate, Delete: resourceCommentDelete, + Description: "Creates a comment for an issue", + Schema: map[string]*schema.Schema{ "body": &schema.Schema{ - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "The contents of the comment to be created", }, "issue_key": &schema.Schema{ Type: schema.TypeString, diff --git a/jira/resource_component.go b/jira/resource_component.go index cd949da6..394e8b91 100644 --- a/jira/resource_component.go +++ b/jira/resource_component.go @@ -20,15 +20,19 @@ func resourceComponent() *schema.Resource { State: schema.ImportStatePassthrough, }, + Description: "Creates a project component", + Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "Name of the component", }, "description": { - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + Description: "Description of the component", }, "assignee_type": { @@ -46,17 +50,20 @@ func resourceComponent() *schema.Resource { DiffSuppressFunc: caseInsensitiveSuppressFunc, Optional: true, Default: "project_default", + Description: "Default assignee type. Can be one of project_default, component_lead, project_lead or unassigned.", }, "lead": { - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + Description: "Component lead", }, "project_key": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "Project Key (for example PRJ)", }, }, } diff --git a/jira/resource_filter.go b/jira/resource_filter.go index ca75492a..2de387e4 100644 --- a/jira/resource_filter.go +++ b/jira/resource_filter.go @@ -60,31 +60,37 @@ func resourceFilter() *schema.Resource { }, Schema: map[string]*schema.Schema{ "name": &schema.Schema{ - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "Name of the filter", }, "description": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + Description: "Description of the filter", }, "jql": &schema.Schema{ - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "JQL expression of the filter", }, "favourite": &schema.Schema{ - Type: schema.TypeBool, - Optional: true, - Default: false, + Type: schema.TypeBool, + Optional: true, + Default: false, + Description: "Whether the filter is marked as favorite", }, "permissions": &schema.Schema{ - Type: schema.TypeSet, - Optional: true, - Set: resourceFilterPermissionsHash, + Type: schema.TypeSet, + Optional: true, + Set: resourceFilterPermissionsHash, + Description: "Filter permissions", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "type": &schema.Schema{ - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "Type of the permission. Needs to be one of global, group, project, project_role or authenticated", ValidateFunc: func(v interface{}, s string) ([]string, []error) { if !(v.(string) == "global" || v.(string) == "group" || @@ -97,8 +103,9 @@ func resourceFilter() *schema.Resource { }, }, "project_id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + Description: "All Members of the project with the given ID can access the filter", }, "project_role_id": &schema.Schema{ @@ -107,8 +114,9 @@ func resourceFilter() *schema.Resource { }, "group_name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + Description: "All Members of the of this group can access the filter", }, "id": &schema.Schema{ diff --git a/main.go b/main.go index a160a1d9..e9ab475b 100644 --- a/main.go +++ b/main.go @@ -6,6 +6,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/plugin" ) +//go:generate go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs generate + func main() { plugin.Serve(&plugin.ServeOpts{ ProviderFunc: func() *schema.Provider { diff --git a/templates/index.md.tmpl b/templates/index.md.tmpl new file mode 100644 index 00000000..5ab0b254 --- /dev/null +++ b/templates/index.md.tmpl @@ -0,0 +1,41 @@ +--- +page_title: "Provider: JIRA" +description: |- + Terraform Provider for managing JIRA. +--- + +# {{ .ProviderShortName | upper }} Provider + +Working in Operations engineering organizations infrastructure is often driven by tickets. +Why not track infrastructure using tickets but this time we will use code. + +## Example Usage + +Set JIRA URL, Username and Password using environment variables + +```bash +export JIRA_URL=http://localhost:8080 +export JIRA_USER=username +export JIRA_PASSWORD=password +``` + +If you prefer Personal Access Tokens + +```bash +export JIRA_URL=http://localhost:8080 +export JIRA_TOKEN= +``` + + +It's also possible to use an API-Token from JIRA cloud. In this case, set + +```bash +export JIRA_URL=https://yourinstance.atlassian.net +export JIRA_USER=username@example.org +export JIRA_PASSWORD= +``` + +{{ tffile "examples/provider/provider.tf" }} + + +{{ .SchemaMarkdown | trimspace }} diff --git a/tools/tools.go b/tools/tools.go new file mode 100644 index 00000000..d72c970c --- /dev/null +++ b/tools/tools.go @@ -0,0 +1,7 @@ +//go:build tools + +package tools + +import ( + _ "github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs" +) diff --git a/website/docs/index.html.markdown b/website/docs/index.html.markdown deleted file mode 100644 index 1226b83f..00000000 --- a/website/docs/index.html.markdown +++ /dev/null @@ -1,43 +0,0 @@ ---- -layout: "jira" -page_title: "Provider: Jira" -description: |- - The Jira provider provides resources to interact with and manage Jira. ---- - -# Jira Provider - -The Jira provider provides resources to interact with and manage Jira projects. - -## Example Usage - -Terraform 0.13 and later: - -```terraform -terraform { - required_providers { - jira = { - source = "fourplusone/jira" - version = "0.1.15" - } - } -} - -# Configure the Jira Provider -provider "jira" { - url = "https://myjira.atlassian.net" # Can also be set using the JIRA_URL environment variable - user = "xxxx" # Can also be set using the JIRA_USER environment variable - password = "xxxx" # Can also be set using the JIRA_PASSWORD environment variable - token = "xxxx" # Can also be set using the JIRA_TOKEN environment variable -} -``` - -## Schema - -- **url** (String, Required) URL for your Jira instance. Can be specified with the JIRA_URL environment variable. - -- **user** (String, Optional) Username for your user. Can be specified with the JIRA_USER environment variable. - -- **password** (String, Optional) Password for the user, can also be an API Token. Can be specified with the JIRA_PASSWORD environment variable. - -- **token** (String, Optional) Password for the user, can also be an API Token. Can be specified with the JIRA_PASSWORD environment variable.