mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-04 13:26:16 +00:00
Terraform Cloud integration
This commit is contained in:
@@ -28,6 +28,8 @@ import {
|
|||||||
INTEGRATION_RENDER_API_URL,
|
INTEGRATION_RENDER_API_URL,
|
||||||
INTEGRATION_SUPABASE,
|
INTEGRATION_SUPABASE,
|
||||||
INTEGRATION_SUPABASE_API_URL,
|
INTEGRATION_SUPABASE_API_URL,
|
||||||
|
INTEGRATION_TERRAFORM_CLOUD,
|
||||||
|
INTEGRATION_TERRAFORM_CLOUD_API_URL,
|
||||||
INTEGRATION_TRAVISCI,
|
INTEGRATION_TRAVISCI,
|
||||||
INTEGRATION_TRAVISCI_API_URL,
|
INTEGRATION_TRAVISCI_API_URL,
|
||||||
INTEGRATION_VERCEL,
|
INTEGRATION_VERCEL,
|
||||||
@@ -124,6 +126,12 @@ const getApps = async ({
|
|||||||
serverId: accessId
|
serverId: accessId
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case INTEGRATION_TERRAFORM_CLOUD:
|
||||||
|
apps = await getAppsTerraformCloud({
|
||||||
|
accessToken,
|
||||||
|
organizationName: accessId,
|
||||||
|
});
|
||||||
|
break;
|
||||||
case INTEGRATION_TRAVISCI:
|
case INTEGRATION_TRAVISCI:
|
||||||
apps = await getAppsTravisCI({
|
apps = await getAppsTravisCI({
|
||||||
accessToken,
|
accessToken,
|
||||||
@@ -532,6 +540,39 @@ const getAppsTravisCI = async ({ accessToken }: { accessToken: string }) => {
|
|||||||
return apps;
|
return apps;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return list of projects for Terraform Cloud integration
|
||||||
|
* @param {Object} obj
|
||||||
|
* @param {String} obj.accessToken - access token for Terraform Cloud API
|
||||||
|
* @returns {Object[]} apps - names and ids of Terraform Cloud projects
|
||||||
|
* @returns {String} apps.name - name of Terraform Cloud projects
|
||||||
|
*/
|
||||||
|
const getAppsTerraformCloud = async ({
|
||||||
|
accessToken,
|
||||||
|
organizationName
|
||||||
|
}: {
|
||||||
|
accessToken: string;
|
||||||
|
organizationName?: string;
|
||||||
|
}) => {
|
||||||
|
const res = (
|
||||||
|
await standardRequest.get(`${INTEGRATION_TERRAFORM_CLOUD_API_URL}/api/v2/organizations/${organizationName}/projects`, {
|
||||||
|
headers: {
|
||||||
|
Authorization: `Bearer ${accessToken}`,
|
||||||
|
Accept: "application/json",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
).data.data;
|
||||||
|
|
||||||
|
const apps = res?.map((a: any) => {
|
||||||
|
return {
|
||||||
|
name: a?.attributes.name,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
return apps;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return list of repositories for GitLab integration
|
* Return list of repositories for GitLab integration
|
||||||
* @param {Object} obj
|
* @param {Object} obj
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ import {
|
|||||||
INTEGRATION_RENDER_API_URL,
|
INTEGRATION_RENDER_API_URL,
|
||||||
INTEGRATION_SUPABASE,
|
INTEGRATION_SUPABASE,
|
||||||
INTEGRATION_SUPABASE_API_URL,
|
INTEGRATION_SUPABASE_API_URL,
|
||||||
|
INTEGRATION_TERRAFORM_CLOUD,
|
||||||
|
INTEGRATION_TERRAFORM_CLOUD_API_URL,
|
||||||
INTEGRATION_TRAVISCI,
|
INTEGRATION_TRAVISCI,
|
||||||
INTEGRATION_TRAVISCI_API_URL,
|
INTEGRATION_TRAVISCI_API_URL,
|
||||||
INTEGRATION_VERCEL,
|
INTEGRATION_VERCEL,
|
||||||
@@ -185,6 +187,14 @@ const syncSecrets = async ({
|
|||||||
accessToken,
|
accessToken,
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case INTEGRATION_TERRAFORM_CLOUD:
|
||||||
|
await syncSecretsTerraformCloud({
|
||||||
|
integration,
|
||||||
|
secrets,
|
||||||
|
accessId,
|
||||||
|
accessToken,
|
||||||
|
});
|
||||||
|
break;
|
||||||
case INTEGRATION_HASHICORP_VAULT:
|
case INTEGRATION_HASHICORP_VAULT:
|
||||||
await syncSecretsHashiCorpVault({
|
await syncSecretsHashiCorpVault({
|
||||||
integration,
|
integration,
|
||||||
@@ -1806,6 +1816,39 @@ const syncSecretsCheckly = async ({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sync/push [secrets] to Terraform Cloud projects with id [integration.appId]
|
||||||
|
* @param {Object} obj
|
||||||
|
* @param {IIntegration} obj.integration - integration details
|
||||||
|
* @param {Object} obj.secrets - secrets to push to integration (object where keys are secret keys and values are secret values)
|
||||||
|
* @param {String} obj.accessToken - access token for Terraform Cloud integration
|
||||||
|
*/
|
||||||
|
const syncSecretsTerraformCloud = async ({
|
||||||
|
integration,
|
||||||
|
secrets,
|
||||||
|
accessId,
|
||||||
|
accessToken,
|
||||||
|
}: {
|
||||||
|
integration: IIntegration;
|
||||||
|
secrets: any;
|
||||||
|
accessId: string | null;
|
||||||
|
accessToken: string;
|
||||||
|
}) => {
|
||||||
|
await standardRequest.put(
|
||||||
|
`${INTEGRATION_TERRAFORM_CLOUD_API_URL}/api/v2/organizations/${accessId}/${integration.app}`,
|
||||||
|
Object.keys(secrets).map((key) => ({
|
||||||
|
key,
|
||||||
|
value: secrets[key],
|
||||||
|
})),
|
||||||
|
{
|
||||||
|
headers: {
|
||||||
|
Authorization: `Bearer ${accessToken}`,
|
||||||
|
Accept: "application/json",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sync/push [secrets] to HashiCorp Vault path
|
* Sync/push [secrets] to HashiCorp Vault path
|
||||||
* @param {Object} obj
|
* @param {Object} obj
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import {
|
|||||||
INTEGRATION_RAILWAY,
|
INTEGRATION_RAILWAY,
|
||||||
INTEGRATION_RENDER,
|
INTEGRATION_RENDER,
|
||||||
INTEGRATION_SUPABASE,
|
INTEGRATION_SUPABASE,
|
||||||
|
INTEGRATION_TERRAFORM_CLOUD,
|
||||||
INTEGRATION_TRAVISCI,
|
INTEGRATION_TRAVISCI,
|
||||||
INTEGRATION_VERCEL,
|
INTEGRATION_VERCEL,
|
||||||
} from "../variables";
|
} from "../variables";
|
||||||
@@ -53,6 +54,7 @@ export interface IIntegration {
|
|||||||
| "travisci"
|
| "travisci"
|
||||||
| "supabase"
|
| "supabase"
|
||||||
| "checkly"
|
| "checkly"
|
||||||
|
| "terraform-cloud"
|
||||||
| "hashicorp-vault"
|
| "hashicorp-vault"
|
||||||
| "cloudflare-pages";
|
| "cloudflare-pages";
|
||||||
integrationAuth: Types.ObjectId;
|
integrationAuth: Types.ObjectId;
|
||||||
@@ -142,6 +144,7 @@ const integrationSchema = new Schema<IIntegration>(
|
|||||||
INTEGRATION_TRAVISCI,
|
INTEGRATION_TRAVISCI,
|
||||||
INTEGRATION_SUPABASE,
|
INTEGRATION_SUPABASE,
|
||||||
INTEGRATION_CHECKLY,
|
INTEGRATION_CHECKLY,
|
||||||
|
INTEGRATION_TERRAFORM_CLOUD,
|
||||||
INTEGRATION_HASHICORP_VAULT,
|
INTEGRATION_HASHICORP_VAULT,
|
||||||
INTEGRATION_CLOUDFLARE_PAGES,
|
INTEGRATION_CLOUDFLARE_PAGES,
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import {
|
|||||||
INTEGRATION_RAILWAY,
|
INTEGRATION_RAILWAY,
|
||||||
INTEGRATION_RENDER,
|
INTEGRATION_RENDER,
|
||||||
INTEGRATION_SUPABASE,
|
INTEGRATION_SUPABASE,
|
||||||
|
INTEGRATION_TERRAFORM_CLOUD,
|
||||||
INTEGRATION_TRAVISCI,
|
INTEGRATION_TRAVISCI,
|
||||||
INTEGRATION_VERCEL
|
INTEGRATION_VERCEL
|
||||||
} from "../variables";
|
} from "../variables";
|
||||||
@@ -25,7 +26,7 @@ import {
|
|||||||
export interface IIntegrationAuth extends Document {
|
export interface IIntegrationAuth extends Document {
|
||||||
_id: Types.ObjectId;
|
_id: Types.ObjectId;
|
||||||
workspace: Types.ObjectId;
|
workspace: Types.ObjectId;
|
||||||
integration: "heroku" | "vercel" | "netlify" | "github" | "gitlab" | "render" | "railway" | "flyio" | "azure-key-vault" | "laravel-forge" | "circleci" | "travisci" | "supabase" | "aws-parameter-store" | "aws-secret-manager" | "checkly" | "cloudflare-pages";
|
integration: "heroku" | "vercel" | "netlify" | "github" | "gitlab" | "render" | "railway" | "flyio" | "azure-key-vault" | "laravel-forge" | "circleci" | "travisci" | "supabase" | "aws-parameter-store" | "aws-secret-manager" | "terraform-cloud" | "checkly" | "cloudflare-pages";
|
||||||
teamId: string;
|
teamId: string;
|
||||||
accountId: string;
|
accountId: string;
|
||||||
url: string;
|
url: string;
|
||||||
@@ -69,6 +70,7 @@ const integrationAuthSchema = new Schema<IIntegrationAuth>(
|
|||||||
INTEGRATION_LARAVELFORGE,
|
INTEGRATION_LARAVELFORGE,
|
||||||
INTEGRATION_TRAVISCI,
|
INTEGRATION_TRAVISCI,
|
||||||
INTEGRATION_SUPABASE,
|
INTEGRATION_SUPABASE,
|
||||||
|
INTEGRATION_TERRAFORM_CLOUD,
|
||||||
INTEGRATION_HASHICORP_VAULT,
|
INTEGRATION_HASHICORP_VAULT,
|
||||||
INTEGRATION_CLOUDFLARE_PAGES,
|
INTEGRATION_CLOUDFLARE_PAGES,
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ export const INTEGRATION_CIRCLECI = "circleci";
|
|||||||
export const INTEGRATION_TRAVISCI = "travisci";
|
export const INTEGRATION_TRAVISCI = "travisci";
|
||||||
export const INTEGRATION_SUPABASE = "supabase";
|
export const INTEGRATION_SUPABASE = "supabase";
|
||||||
export const INTEGRATION_CHECKLY = "checkly";
|
export const INTEGRATION_CHECKLY = "checkly";
|
||||||
|
export const INTEGRATION_TERRAFORM_CLOUD = "terraform-cloud";
|
||||||
export const INTEGRATION_HASHICORP_VAULT = "hashicorp-vault";
|
export const INTEGRATION_HASHICORP_VAULT = "hashicorp-vault";
|
||||||
export const INTEGRATION_CLOUDFLARE_PAGES = "cloudflare-pages";
|
export const INTEGRATION_CLOUDFLARE_PAGES = "cloudflare-pages";
|
||||||
export const INTEGRATION_SET = new Set([
|
export const INTEGRATION_SET = new Set([
|
||||||
@@ -40,6 +41,7 @@ export const INTEGRATION_SET = new Set([
|
|||||||
INTEGRATION_TRAVISCI,
|
INTEGRATION_TRAVISCI,
|
||||||
INTEGRATION_SUPABASE,
|
INTEGRATION_SUPABASE,
|
||||||
INTEGRATION_CHECKLY,
|
INTEGRATION_CHECKLY,
|
||||||
|
INTEGRATION_TERRAFORM_CLOUD,
|
||||||
INTEGRATION_HASHICORP_VAULT,
|
INTEGRATION_HASHICORP_VAULT,
|
||||||
INTEGRATION_CLOUDFLARE_PAGES
|
INTEGRATION_CLOUDFLARE_PAGES
|
||||||
]);
|
]);
|
||||||
@@ -70,6 +72,7 @@ export const INTEGRATION_TRAVISCI_API_URL = "https://api.travis-ci.com";
|
|||||||
export const INTEGRATION_SUPABASE_API_URL = "https://api.supabase.com";
|
export const INTEGRATION_SUPABASE_API_URL = "https://api.supabase.com";
|
||||||
export const INTEGRATION_LARAVELFORGE_API_URL = "https://forge.laravel.com";
|
export const INTEGRATION_LARAVELFORGE_API_URL = "https://forge.laravel.com";
|
||||||
export const INTEGRATION_CHECKLY_API_URL = "https://api.checklyhq.com";
|
export const INTEGRATION_CHECKLY_API_URL = "https://api.checklyhq.com";
|
||||||
|
export const INTEGRATION_TERRAFORM_CLOUD_API_URL = "https://app.terraform.io";
|
||||||
export const INTEGRATION_CLOUDFLARE_PAGES_API_URL = "https://api.cloudflare.com";
|
export const INTEGRATION_CLOUDFLARE_PAGES_API_URL = "https://api.cloudflare.com";
|
||||||
|
|
||||||
export const getIntegrationOptions = async () => {
|
export const getIntegrationOptions = async () => {
|
||||||
@@ -219,6 +222,15 @@ export const getIntegrationOptions = async () => {
|
|||||||
clientId: "",
|
clientId: "",
|
||||||
docsLink: "",
|
docsLink: "",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "Terraform Cloud",
|
||||||
|
slug: "terraform-cloud",
|
||||||
|
image: "Terraform Cloud.png",
|
||||||
|
isAvailable: true,
|
||||||
|
type: "pat",
|
||||||
|
cliendId: "",
|
||||||
|
docsLink: "",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "HashiCorp Vault",
|
name: "HashiCorp Vault",
|
||||||
slug: "hashicorp-vault",
|
slug: "hashicorp-vault",
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 6.6 KiB |
@@ -86,6 +86,9 @@ export const redirectForProviderAuth = (integrationOption: TCloudIntegration) =>
|
|||||||
case "railway":
|
case "railway":
|
||||||
link = `${window.location.origin}/integrations/railway/authorize`;
|
link = `${window.location.origin}/integrations/railway/authorize`;
|
||||||
break;
|
break;
|
||||||
|
case "terraform-cloud":
|
||||||
|
link = `${window.location.origin}/integrations/terraform-cloud/authorize`;
|
||||||
|
break;
|
||||||
case "hashicorp-vault":
|
case "hashicorp-vault":
|
||||||
link = `${window.location.origin}/integrations/hashicorp-vault/authorize`;
|
link = `${window.location.origin}/integrations/hashicorp-vault/authorize`;
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user