Terraform Cloud Secret Sync Integration Docs

This commit is contained in:
carlosmonastyrski
2025-04-04 10:46:23 -03:00
parent 4d41513abf
commit ec9897d561
32 changed files with 334 additions and 3 deletions

View File

@@ -0,0 +1,4 @@
---
title: "Available"
openapi: "GET /api/v1/app-connections/terraform-cloud/available"
---

View File

@@ -0,0 +1,4 @@
---
title: "Create"
openapi: "POST /api/v1/app-connections/terraform-cloud"
---

View File

@@ -0,0 +1,4 @@
---
title: "Delete"
openapi: "DELETE /api/v1/app-connections/terraform-cloud/{connectionId}"
---

View File

@@ -0,0 +1,4 @@
---
title: "Get by ID"
openapi: "GET /api/v1/app-connections/terraform-cloud/{connectionId}"
---

View File

@@ -0,0 +1,4 @@
---
title: "Get by Name"
openapi: "GET /api/v1/app-connections/terraform-cloud/connection-name/{connectionName}"
---

View File

@@ -0,0 +1,4 @@
---
title: "List"
openapi: "GET /api/v1/app-connections/terraform-cloud"
---

View File

@@ -0,0 +1,4 @@
---
title: "Update"
openapi: "PATCH /api/v1/app-connections/terraform-cloud/{connectionId}"
---

View File

@@ -0,0 +1,4 @@
---
title: "Create"
openapi: "POST /api/v1/secret-syncs/terraform-cloud"
---

View File

@@ -0,0 +1,4 @@
---
title: "Delete"
openapi: "DELETE /api/v1/secret-syncs/terraform-cloud/{syncId}"
---

View File

@@ -0,0 +1,4 @@
---
title: "Get by ID"
openapi: "GET /api/v1/secret-syncs/terraform-cloud/{syncId}"
---

View File

@@ -0,0 +1,4 @@
---
title: "Get by Name"
openapi: "GET /api/v1/secret-syncs/terraform-cloud/sync-name/{syncName}"
---

View File

@@ -0,0 +1,4 @@
---
title: "List"
openapi: "GET /api/v1/secret-syncs/terraform-cloud"
---

View File

@@ -0,0 +1,4 @@
---
title: "Remove Secrets"
openapi: "POST /api/v1/secret-syncs/terraform-cloud/{syncId}/remove-secrets"
---

View File

@@ -0,0 +1,4 @@
---
title: "Sync Secrets"
openapi: "POST /api/v1/secret-syncs/terraform-cloud/{syncId}/sync-secrets"
---

View File

@@ -0,0 +1,4 @@
---
title: "Update"
openapi: "PATCH /api/v1/secret-syncs/terraform-cloud/{syncId}"
---

Binary file not shown.

After

Width:  |  Height:  |  Size: 241 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 909 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 573 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 581 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 345 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 633 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 608 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 634 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 667 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 639 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 604 KiB

View File

@@ -0,0 +1,83 @@
---
title: "Terraform Cloud Connection"
description: "Learn how to configure a Terraform Cloud Connection for Infisical."
---
Infisical supports connecting to Terraform Cloud using a service user.
## Setup Terraform Cloud Connection in Infisical
<Steps>
<Step title="Move to Account Settings on Terraform Cloud">
Navigate to the Terraform Cloud **Account Settings** tab.
![Terraform Cloud Account Settings](/images/app-connections/terraform-cloud/terraform-cloud-account-settings.png)
</Step>
<Step title="Move to Tokens Tab">
Move to the **Tokens** tab.
![Terraform Cloud Tokens Tab](/images/app-connections/terraform-cloud/terraform-cloud-tokens-tab.png)
</Step>
<Step title="Create the API Token">
Create the API token to be used by Infisical.
<Note>
If you configure an expiry date for your API token you will need to manually rotate to a new token prior to expiration to avoid integration downtime.
</Note>
![Terraform Cloud Create API Token](/images/app-connections/terraform-cloud/terraform-cloud-create-api-token.png)
</Step>
<Step title="Copy the API Token">
The API token will be displayed after creating it. Save the token in a secure location for later use in the following steps.
![Terraform Cloud Copy API Token](/images/app-connections/terraform-cloud/terraform-cloud-copy-api-token.png)
</Step>
<Step title="Add Terraform Cloud Connection in Infisical">
<Tabs>
<Tab title="Infisical UI">
1. Navigate to the **App Connections** tab on the **Organization Settings** page.
![App Connections Tab](/images/app-connections/general/add-connection.png)
2. Select the **Terraform Cloud Connection** option from the connection options modal.
![Select Terraform Cloud Connection](/images/app-connections/terraform-cloud/terraform-cloud-app-connection-option.png)
3. Fill the Terraform Cloud Connection modal, here you will need to provide the API Token generated in the previous step.
![Terraform Cloud Connection Modal](/images/app-connections/terraform-cloud/terraform-cloud-app-connection-modal.png)
4. Your **Terraform Cloud Connection** is now available for use.
![Terraform Cloud Connection Created](/images/app-connections/terraform-cloud/terraform-cloud-app-connection-created.png)
</Tab>
<Tab title="API">
To create an Terraform Cloud Connection, make an API request to the [Create Terraform Cloud
Connection](/api-reference/endpoints/app-connections/terraform-cloud/create) API endpoint.
### Sample request
```bash Request
curl --request POST \
--url https://app.infisical.com/api/v1/app-connections/terraform-cloud \
--header 'Content-Type: application/json' \
--data '{
"name": "my-terraform-cloud-connection",
"method": "api-token",
"credentials": {
"apiToken": "...",
}
}'
```
### Sample response
```bash Response
{
"appConnection": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "my-terraform-cloud-connection",
"version": 123,
"orgId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"app": "terraform-cloud",
"method": "api-token",
"credentials": {
"apiToken": "..."
}
}
}
```
</Tab>
</Tabs>
</Step>
</Steps>

View File

@@ -0,0 +1,161 @@
---
title: "Terraform Cloud Sync"
description: "Learn how to configure a Terraform Cloud Sync for Infisical."
---
**Prerequisites:**
- Set up and add secrets to [Infisical Cloud](https://app.infisical.com)
- Create a [Terraform Cloud Connection](/integrations/app-connections/terraform-cloud)
<Tabs>
<Tab title="Infisical UI">
1. Navigate to **Project** > **Integrations** and select the **Secret Syncs** tab. Click on the **Add Sync** button.
![Secret Syncs Tab](/images/secret-syncs/general/secret-sync-tab.png)
2. Select the **Terraform Cloud** option.
![Select Terraform Cloud](/images/secret-syncs/terraform-cloud/terraform-cloud-option.png)
3. Configure the **Source** from where secrets should be retrieved, then click **Next**.
![Configure Source](/images/secret-syncs/terraform-cloud/terraform-cloud-source.png)
- **Environment**: The project environment to retrieve secrets from.
- **Secret Path**: The folder path to retrieve secrets from.
<Tip>
If you need to sync secrets from multiple folder locations, check out [secret imports](/documentation/platform/secret-reference#secret-imports).
</Tip>
4. Configure the **Destination** to where secrets should be deployed, then click **Next**.
![Configure Destination](/images/secret-syncs/terraform-cloud/terraform-cloud-destination.png)
- **Terraform Cloud Connection**: The Terraform Cloud Connection to authenticate with.
- **Organization**: The Terraform Cloud organization to deploy secrets to.
- **Category**: The Terraform Cloud variable category to use on secrets syncs. Choose from:
- **Environment**: Sync secrets as environment variables.
- **Terraform**: Sync secrets as Terraform variables.
- **Scope**: The Terraform Cloud secret scope to sync secrets to.
- **Variable Set**: Sync secrets to a specific variable set.
- **Workspace**: Sync secrets to a specific workspace.
<p class="height:1px" />
The remaining fields are determined by the selected **Scope**:
<AccordionGroup>
<Accordion title="Variable Set">
- **Variable Set**: The variable set to deploy secrets to.
</Accordion>
<Accordion title="Workspace">
- **Workspace**: The workspace to deploy secrets to.
</Accordion>
</AccordionGroup>
5. Configure the **Sync Options** to specify how secrets should be synced, then click **Next**.
![Configure Options](/images/secret-syncs/terraform-cloud/terraform-cloud-options.png)
- **Initial Sync Behavior**: Determines how Infisical should resolve the initial sync.
- **Overwrite Destination Secrets**: Removes any secrets at the destination endpoint not present in Infisical.
<Note>
Terraform Cloud does not support importing secrets.
</Note>
- **Auto-Sync Enabled**: If enabled, secrets will automatically be synced from the source location when changes occur. Disable to enforce manual syncing only.
- **Disable Secret Deletion**: If enabled, Infisical will not remove secrets from the sync destination. Enable this option if you intend to manage some secrets manually outside of Infisical.
6. Configure the **Details** of your Terraform Cloud Sync, then click **Next**.
![Configure Details](/images/secret-syncs/terraform-cloud/terraform-cloud-details.png)
- **Name**: The name of your sync. Must be slug-friendly.
- **Description**: An optional description for your sync.
7. Review your Terraform Cloud Sync configuration, then click **Create Sync**.
![Confirm Configuration](/images/secret-syncs/terraform-cloud/terraform-cloud-review.png)
8. If enabled, your Terraform Cloud Sync will begin syncing your secrets to the destination endpoint.
![Sync Secrets](/images/secret-syncs/terraform-cloud/terraform-cloud-created.png)
</Tab>
<Tab title="API">
To create an **Terraform Cloud Sync**, make an API request to the [Create Terraform Cloud Sync](/api-reference/endpoints/secret-syncs/terraform-cloud/create) API endpoint.
### Sample request
```bash Request
curl --request POST \
--url https://app.infisical.com/api/v1/secret-syncs/terraform-cloud \
--header 'Content-Type: application/json' \
--data '{
"name": "my-terraform-cloud-sync",
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"description": "an example sync",
"connectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"environment": "dev",
"secretPath": "/my-secrets",
"isEnabled": true,
"syncOptions": {
"initialSyncBehavior": "overwrite-destination"
},
"destinationConfig": {
"scope": "variable-set",
"destinationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
"destinationName": "my-variable-set",
"org": "my-organization-id",
"category": "env"
}
}'
```
### Sample response
```bash Response
{
"secretSync": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "my-terraform-cloud-sync",
"description": "an example sync",
"isEnabled": true,
"version": 1,
"folderId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"connectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"syncStatus": "succeeded",
"lastSyncJobId": "123",
"lastSyncMessage": null,
"lastSyncedAt": "2023-11-07T05:31:56Z",
"importStatus": null,
"lastImportJobId": null,
"lastImportMessage": null,
"lastImportedAt": null,
"removeStatus": null,
"lastRemoveJobId": null,
"lastRemoveMessage": null,
"lastRemovedAt": null,
"syncOptions": {
"initialSyncBehavior": "overwrite-destination"
},
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"connection": {
"app": "terraform-cloud",
"name": "my-terraform-cloud-connection",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"environment": {
"slug": "dev",
"name": "Development",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"folder": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"path": "/my-secrets"
},
"destination": "terraform-cloud",
"destinationConfig": {
"scope": "workspace",
"destinationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"destinationName": "my-workspace",
"org": "my-organization-id",
"category": "terraform"
}
}
}
```
</Tab>
</Tabs>

View File

@@ -1,6 +1,6 @@
{
"name": "Infisical",
"openapi": "https://app.infisical.com/api/docs/json",
"openapi": "https://1243-190-31-36-142.ngrok-free.app/api/docs/json",
"logo": {
"dark": "/logo/dark.svg",
"light": "/logo/light.svg",
@@ -419,7 +419,8 @@
"integrations/app-connections/databricks",
"integrations/app-connections/gcp",
"integrations/app-connections/github",
"integrations/app-connections/humanitec"
"integrations/app-connections/humanitec",
"integrations/app-connections/terraform-cloud"
]
}
]
@@ -438,7 +439,8 @@
"integrations/secret-syncs/databricks",
"integrations/secret-syncs/gcp-secret-manager",
"integrations/secret-syncs/github",
"integrations/secret-syncs/humanitec"
"integrations/secret-syncs/humanitec",
"integrations/secret-syncs/terraform-cloud"
]
}
]
@@ -922,6 +924,18 @@
"api-reference/endpoints/app-connections/humanitec/update",
"api-reference/endpoints/app-connections/humanitec/delete"
]
},
{
"group": "Terraform Cloud",
"pages": [
"api-reference/endpoints/app-connections/terraform-cloud/list",
"api-reference/endpoints/app-connections/terraform-cloud/available",
"api-reference/endpoints/app-connections/terraform-cloud/get-by-id",
"api-reference/endpoints/app-connections/terraform-cloud/get-by-name",
"api-reference/endpoints/app-connections/terraform-cloud/create",
"api-reference/endpoints/app-connections/terraform-cloud/update",
"api-reference/endpoints/app-connections/terraform-cloud/delete"
]
}
]
},
@@ -1038,6 +1052,19 @@
"api-reference/endpoints/secret-syncs/humanitec/sync-secrets",
"api-reference/endpoints/secret-syncs/humanitec/remove-secrets"
]
},
{
"group": "Terraform Cloud",
"pages": [
"api-reference/endpoints/secret-syncs/terraform-cloud/list",
"api-reference/endpoints/secret-syncs/terraform-cloud/get-by-id",
"api-reference/endpoints/secret-syncs/terraform-cloud/get-by-name",
"api-reference/endpoints/secret-syncs/terraform-cloud/create",
"api-reference/endpoints/secret-syncs/terraform-cloud/update",
"api-reference/endpoints/secret-syncs/terraform-cloud/delete",
"api-reference/endpoints/secret-syncs/terraform-cloud/sync-secrets",
"api-reference/endpoints/secret-syncs/terraform-cloud/remove-secrets"
]
}
]
},