From 072749e69cb963e9be4a3a55ff136ba2024de931 Mon Sep 17 00:00:00 2001 From: Glenn Sarti Date: Fri, 3 May 2024 12:03:01 +0800 Subject: [PATCH] Update documentation and changelog This commit updates the documentation and changelog for the Global Run Tasks feature. --- CHANGELOG.md | 6 ++ ...ion_run_task_global_settings.html.markdown | 34 ++++++++++++ .../docs/d/workspace_run_task.html.markdown | 3 +- ...ion_run_task_global_settings.html.markdown | 55 +++++++++++++++++++ .../docs/r/workspace_run_task.html.markdown | 4 +- 5 files changed, 100 insertions(+), 2 deletions(-) create mode 100644 website/docs/d/organization_run_task_global_settings.html.markdown create mode 100644 website/docs/r/organization_run_task_global_settings.html.markdown diff --git a/CHANGELOG.md b/CHANGELOG.md index 672418c61..07c7f8e2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,10 +6,16 @@ ENHANCEMENTS: * `d/tfe_workspace`: Add an `auto_destroy_at` attribute for reading a scheduled auto-destroy, by @notchairmk [1354](https://github.com/hashicorp/terraform-provider-tfe/pull/1354) * `r/tfe_registry_module`: Add `initial_version` support for Branch Based Modules by @aaabdelgany [#1363](https://github.com/hashicorp/terraform-provider-tfe/pull/1363) * `r/tfe_oauth_client`: Add `agent_pool_id` as an optional argument to enable Private VCS support, by @roleesinhaHC [1255](https://github.com/hashicorp/terraform-provider-tfe/pull/1255) +* `d/tfe_organization_run_task_global_settings`: Added a datasource to retrieve the global settings of Run tasks, by @glennsarti [#1328](https://github.com/hashicorp/terraform-provider-tfe/pull/1330) +* `r/tfe_organization_run_task_global_settings`: Added a resource to manage the global settings of Run tasks, by @glennsarti [#1328](https://github.com/hashicorp/terraform-provider-tfe/pull/1330) BUG FIXES: * `r/tfe_registry_module`: Prevents constant diff after a successful apply when `tags` and `tests_enabled` is not set by @Uk1288 [#1357](https://github.com/hashicorp/terraform-provider-tfe/pull/1357) +DEPRECATIONS and BREAKING CHANGES: +* `r/_workspace_run_task`: The `stage` attribute has been deprecated in favor of the `stages` attribute, by @glennsarti [#1328](https://github.com/hashicorp/terraform-provider-tfe/pull/1330) +* `d/_workspace_run_task`: The `stage` attribute has been deprecated in favor of the `stages` attribute, by @glennsarti [#1328](https://github.com/hashicorp/terraform-provider-tfe/pull/1330) + ## v0.55.0 FEATURES: diff --git a/website/docs/d/organization_run_task_global_settings.html.markdown b/website/docs/d/organization_run_task_global_settings.html.markdown new file mode 100644 index 000000000..3ce36a2e6 --- /dev/null +++ b/website/docs/d/organization_run_task_global_settings.html.markdown @@ -0,0 +1,34 @@ +--- +layout: "tfe" +page_title: "Terraform Enterprise: tfe_organization_run_task_global_settings" +description: |- + Get information on a Run task's global settings. +--- + +# Data Source: tfe_organization_run_task_global_settings + +[Run tasks](https://developer.hashicorp.com/terraform/cloud-docs/workspaces/settings/run-tasks) allow HCP Terraform to interact with external systems at specific points in the HCP Terraform run lifecycle. Run tasks are reusable configurations that you can attach to any workspace in an organization. + +The tfe_organization_run_task_global_settings resource creates, updates and destroys the [global settings](https://developer.hashicorp.com/terraform/cloud-docs/workspaces/settings/run-tasks#global-run-tasks) for an [Organization Run task](https://developer.hashicorp.com/terraform/cloud-docs/workspaces/settings/run-tasks#creating-a-run-task). Your organization must have the `global-run-task` [entitlement](https://developer.hashicorp.com/terraform/cloud-docs/api-docs#feature-entitlements) to use global run tasks. + +## Example Usage + +```hcl +data "tfe_organization_run_task_global_settings" "example" { + task_id = "task-abc123" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `task_id` - (Required) The id of the Run task with the global settings. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `enabled` - Whether the run task will be applied globally. +* `enforcement_level` - The enforcement level of the global task. Valid values are `advisory` and `mandatory`. +* `stages` - The stages to run the task in. Valid values are one or more of `pre_plan`, `post_plan`, `pre_apply` and `post apply`. diff --git a/website/docs/d/workspace_run_task.html.markdown b/website/docs/d/workspace_run_task.html.markdown index 05d0131ad..f722a7e17 100644 --- a/website/docs/d/workspace_run_task.html.markdown +++ b/website/docs/d/workspace_run_task.html.markdown @@ -33,4 +33,5 @@ In addition to all arguments above, the following attributes are exported: * `enforcement_level` - The enforcement level of the task. * `id` - The ID of the Workspace Run task. -* `stage` - Which stage the task will run in. +* `stage` - **Deprecated** Use `stages` instead. +* `stages` - Which stages the task will run in. diff --git a/website/docs/r/organization_run_task_global_settings.html.markdown b/website/docs/r/organization_run_task_global_settings.html.markdown new file mode 100644 index 000000000..295b2be6c --- /dev/null +++ b/website/docs/r/organization_run_task_global_settings.html.markdown @@ -0,0 +1,55 @@ +--- +layout: "tfe" +page_title: "Terraform Enterprise: tfe_organization_run_task_global_settings" +description: |- + Manages Run tasks global settings. +--- + +# tfe_organization_run_task_global_settings + +[Run tasks](https://developer.hashicorp.com/terraform/cloud-docs/workspaces/settings/run-tasks) allow HCP Terraform to interact with external systems at specific points in the HCP Terraform run lifecycle. Run tasks are reusable configurations that you can attach to any workspace in an organization. + +The tfe_organization_run_task_global_settings resource creates, updates and destroys the [global settings](https://developer.hashicorp.com/terraform/cloud-docs/workspaces/settings/run-tasks#global-run-tasks) for an [Organization Run task](https://developer.hashicorp.com/terraform/cloud-docs/workspaces/settings/run-tasks#creating-a-run-task). Your organization must have the `global-run-task` [entitlement](https://developer.hashicorp.com/terraform/cloud-docs/api-docs#feature-entitlements) to use global run tasks. + +## Example Usage + +Basic usage: + +```hcl +resource "tfe_organization_run_task_global_settings" "example" { + task_id = tfe_organization_run_task.example.id + enabled = true + enforcement_level = "advisory" + stages = ["pre_plan", "post_plan"] +} + +resource "tfe_organization_run_task" "example" { + organization = "org-name" + url = "https://external.service.com" + name = "task-name" + enabled = true + description = "An example task" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `enabled` - (Optional) Whether the run task will be applied globally. +* `enforcement_level` - (Required) The enforcement level of the global task. Valid values are `advisory` and `mandatory`. +* `stages` - (Required) The stages to run the task in. Valid values are one or more of `pre_plan`, `post_plan`, `pre_apply` and `post apply`. +* `task_id` - (Required) The id of the Run task which will have the global settings applied. + +## Attributes Reference + +* `id` - The ID of the global settings. + +## Import + +Run task global settings can be imported; use `/` as the +import ID. For example: + +```shell +terraform import tfe_organization_run_task_global_settings.test my-org-name/task-name +``` diff --git a/website/docs/r/workspace_run_task.html.markdown b/website/docs/r/workspace_run_task.html.markdown index de0b3a012..f59be587b 100644 --- a/website/docs/r/workspace_run_task.html.markdown +++ b/website/docs/r/workspace_run_task.html.markdown @@ -20,6 +20,7 @@ resource "tfe_workspace_run_task" "example" { workspace_id = resource.tfe_workspace.example.id task_id = resource.tfe_organization_run_task.example.id enforcement_level = "advisory" + stages = ["pre_plan"] } ``` @@ -30,7 +31,8 @@ The following arguments are supported: * `enforcement_level` - (Required) The enforcement level of the task. Valid values are `advisory` and `mandatory`. * `task_id` - (Required) The id of the Run task to associate to the Workspace. * `workspace_id` - (Required) The id of the workspace to associate the Run task to. -* `stage` - (Optional) The stage to run the task in. Valid values are `pre_plan`, `post_plan`, and `pre_apply`. +* `stage` - **Deprecated** Use `stages` instead. +* `stages` - (Optional) The stages to run the task in. Valid values are one or more of `pre_plan`, `post_plan`, `pre_apply` and `post apply`. ## Attributes Reference