generated from hashicorp/terraform-provider-scaffolding
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #114 from hashicorp/sync-public-and-internal-provider
[auto] Sync with Public Provider
- Loading branch information
Showing
39 changed files
with
941 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
--- | ||
page_title: "hcp_packer_run_task Data Source - terraform-provider-hcp" | ||
subcategory: "" | ||
description: |- | ||
The Packer Run Task data source gets the configuration information needed to set up an HCP Packer Registry's run task. | ||
--- | ||
|
||
# hcp_packer_run_task (Data Source) | ||
|
||
-> **Note:** This data source is currently in public beta. | ||
|
||
-> **Note:** Use of this data source in the same workspace as an | ||
`hcp_packer_run_task` resource (pointing to the same HCP Project) is | ||
discouraged. If this is not possible (ex: using a module containing the data | ||
source in the same workspace as a copy of the resource), use the `depends_on` | ||
meta-argument to mark the data source as dependent on the resource. | ||
|
||
The Packer Run Task data source gets the configuration information needed to set up an HCP Packer Registry's run task. | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
data "hcp_packer_run_task" "registry" {} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Optional | ||
|
||
- `project_id` (String) The ID of the HCP project where the HCP Packer Registry is located. | ||
If not specified, the project specified in the HCP Provider config block will be used, if configured. | ||
If a project is not configured in the HCP Provider config block, the oldest project in the organization will be used. | ||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts)) | ||
|
||
### Read-Only | ||
|
||
- `endpoint_url` (String) A unique HCP Packer URL, specific to your HCP organization and HCP Packer registry. The Terraform Cloud run task will send a payload to this URL for image validation. | ||
- `hmac_key` (String, Sensitive) A secret key that lets HCP Packer verify the run task request. | ||
- `id` (String) The ID of this resource. | ||
- `organization_id` (String) The ID of the HCP organization where this channel is located. Always the same as the associated channel. | ||
|
||
<a id="nestedblock--timeouts"></a> | ||
### Nested Schema for `timeouts` | ||
|
||
Optional: | ||
|
||
- `default` (String) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
--- | ||
subcategory: "" | ||
page_title: "Packer Run Tasks with Terraform - HCP Provider" | ||
description: |- | ||
A guide to integrating HCP Packer with Terraform using Run Tasks. | ||
--- | ||
|
||
# Adding an HCP Packer Run Task to Terraform Cloud or Terraform Enterprise | ||
|
||
You can add an HCP Packer Run Task to Terraform Cloud or Terraform Enterprise | ||
by combining the HCP Terraform Provider and the | ||
[Terraform Cloud/Enterprise Provider](https://registry.terraform.io/providers/hashicorp/tfe). | ||
|
||
## Using the `hcp_packer_run_task` Data Source | ||
|
||
If the Terraform workspace where this config will live already has an | ||
`hcp_packer_run_task` resource, you should use the resource instead. | ||
|
||
```terraform | ||
data "hcp_packer_run_task" "registry" {} | ||
resource "tfe_organization_run_task" "hcp_packer" { | ||
name = "HCP_Packer" | ||
description = "Ensure usage of compliant images from HCP Packer." | ||
enabled = true | ||
url = data.hcp_packer_run_task.registry.endpoint_url | ||
hmac_key = data.hcp_packer_run_task.registry.hmac_key | ||
} | ||
``` | ||
|
||
## Using the `hcp_packer_run_task` Resource | ||
|
||
If the Terraform workspace where this config will live does not already have a | ||
`hcp_packer_run_task` resource and you don't need to be able to regenerate the | ||
HMAC Key in that workspace, you should use the data source instead. | ||
|
||
```terraform | ||
resource "hcp_packer_run_task" "registry" { | ||
regenerate_hmac = false | ||
} | ||
resource "tfe_organization_run_task" "hcp_packer" { | ||
name = "HCP_Packer" | ||
description = "Ensure usage of compliant images from HCP Packer." | ||
enabled = true | ||
url = hcp_packer_run_task.registry.endpoint_url | ||
hmac_key = hcp_packer_run_task.registry.hmac_key | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
--- | ||
page_title: "hcp_packer_run_task Resource - terraform-provider-hcp" | ||
subcategory: "" | ||
description: |- | ||
The Packer Run Task resource allows you to regenerate the HMAC key for an HCP Packer Registry's run task. | ||
If you do not need to regenerate the HMAC key, it is recommended to use the hcp_packer_run_task data source instead. | ||
--- | ||
|
||
# hcp_packer_run_task (Resource) | ||
|
||
-> **Note:** This resource is currently in public beta. | ||
|
||
The Packer Run Task resource allows you to regenerate the HMAC key for an HCP Packer Registry's run task. | ||
|
||
If you do not need to regenerate the HMAC key, it is recommended to use the `hcp_packer_run_task` data source instead. | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
resource "hcp_packer_run_task" "registry" {} | ||
# Configuring the HMAC Key to regenerate on apply | ||
# NOTE: While `regenerate_hmac` is set to `true` the key will be regenerated on every apply. | ||
resource "hcp_packer_run_task" "registry" { | ||
regenerate_hmac = true | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Optional | ||
|
||
- `project_id` (String) The ID of the HCP project where the HCP Packer Registry is located. | ||
If not specified, the project specified in the HCP Provider config block will be used, if configured. | ||
If a project is not configured in the HCP Provider config block, the oldest project in the organization will be used. | ||
- `regenerate_hmac` (Boolean) If true, the HMAC Key (`hmac_key`) will be regenerated during `terraform apply`. While set to true, the key will be regenerated on every `terraform apply` until `regenerate_hmac` is set to false or removed from the config. | ||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts)) | ||
|
||
### Read-Only | ||
|
||
- `endpoint_url` (String) A unique HCP Packer URL, specific to your HCP organization and HCP Packer registry. The Terraform Cloud run task will send a payload to this URL for image validation. | ||
- `hmac_key` (String, Sensitive) A secret key that lets HCP Packer verify the run task request. | ||
- `id` (String) The ID of this resource. | ||
- `organization_id` (String) The ID of the HCP organization where this channel is located. Always the same as the associated channel. | ||
|
||
<a id="nestedblock--timeouts"></a> | ||
### Nested Schema for `timeouts` | ||
|
||
Optional: | ||
|
||
- `create` (String) | ||
- `default` (String) | ||
- `delete` (String) | ||
- `update` (String) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
data "hcp_packer_run_task" "registry" {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
data "hcp_packer_run_task" "registry" {} | ||
|
||
resource "tfe_organization_run_task" "hcp_packer" { | ||
name = "HCP_Packer" | ||
description = "Ensure usage of compliant images from HCP Packer." | ||
enabled = true | ||
|
||
url = data.hcp_packer_run_task.registry.endpoint_url | ||
hmac_key = data.hcp_packer_run_task.registry.hmac_key | ||
} |
12 changes: 12 additions & 0 deletions
12
examples/guides/packer_run_tasks_with_terraform/resource.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
resource "hcp_packer_run_task" "registry" { | ||
regenerate_hmac = false | ||
} | ||
|
||
resource "tfe_organization_run_task" "hcp_packer" { | ||
name = "HCP_Packer" | ||
description = "Ensure usage of compliant images from HCP Packer." | ||
enabled = true | ||
|
||
url = hcp_packer_run_task.registry.endpoint_url | ||
hmac_key = hcp_packer_run_task.registry.hmac_key | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
resource "hcp_packer_run_task" "registry" {} | ||
|
||
# Configuring the HMAC Key to regenerate on apply | ||
# NOTE: While `regenerate_hmac` is set to `true` the key will be regenerated on every apply. | ||
resource "hcp_packer_run_task" "registry" { | ||
regenerate_hmac = true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
// Copyright (c) HashiCorp, Inc. | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
package provider | ||
|
||
import ( | ||
|
Oops, something went wrong.