mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
Terraform Cloud integration
This commit is contained in:
@@ -1832,60 +1832,28 @@ const syncSecretsTerraformCloud = async ({
|
|||||||
accessToken: string;
|
accessToken: string;
|
||||||
}) => {
|
}) => {
|
||||||
|
|
||||||
const payload = Object.entries(secrets).map(([key, value]) => {
|
Object.entries(secrets).map( async ([key, value]) =>
|
||||||
const payloadObj = {
|
await standardRequest.post(
|
||||||
data: {
|
`${INTEGRATION_TERRAFORM_CLOUD_API_URL}/api/v2/workspaces/${integration.appId}/vars`,
|
||||||
type: 'vars',
|
{
|
||||||
attributes: {
|
data: {
|
||||||
key,
|
type: 'vars',
|
||||||
value,
|
attributes: {
|
||||||
category: `${integration.targetService}`,
|
key,
|
||||||
|
value,
|
||||||
|
category: `${integration.targetService}`,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
{
|
||||||
|
headers: {
|
||||||
return standardRequest.post(`${INTEGRATION_TERRAFORM_CLOUD_API_URL}/api/v2/workspaces/${integration.appId}/vars`, payloadObj, {
|
Authorization: `Bearer ${accessToken}`,
|
||||||
headers: {
|
"Content-Type": "application/vnd.api+json",
|
||||||
Authorization: `Bearer ${accessToken}`,
|
Accept: "application/vnd.api+json",
|
||||||
"Content-Type": "application/vnd.api+json",
|
},
|
||||||
"Accept": "application/vnd.api+json"
|
}
|
||||||
},
|
)
|
||||||
});
|
)
|
||||||
});
|
|
||||||
|
|
||||||
Promise.all(payload);
|
|
||||||
|
|
||||||
|
|
||||||
// get secrets from Terraform Cloud
|
|
||||||
// const getSecretsRes = (
|
|
||||||
// await standardRequest.get(
|
|
||||||
// `${INTEGRATION_TERRAFORM_CLOUD_API_URL}/api/v2/workspaces/${integration.app}/vars`,
|
|
||||||
// {
|
|
||||||
// headers: {
|
|
||||||
// Authorization: `Bearer ${accessToken}`,
|
|
||||||
// "Content-Type": "application/vnd.api+json",
|
|
||||||
// "Accept": "application/vnd.api+json"
|
|
||||||
// },
|
|
||||||
// }
|
|
||||||
// )
|
|
||||||
// ).data;
|
|
||||||
|
|
||||||
// delete secrets from Terraform Cloud
|
|
||||||
// getSecretsRes.forEach(async (data: any) => {
|
|
||||||
// if (!(data.attributes.name in secrets)) {
|
|
||||||
// await standardRequest.delete(
|
|
||||||
// `${INTEGRATION_TERRAFORM_CLOUD_API_URL}/api/v2/workspaces/${integration.app}/vars/${data.id}`,
|
|
||||||
// {
|
|
||||||
// headers: {
|
|
||||||
// Authorization: `Bearer ${accessToken}`,
|
|
||||||
// "Content-Type": "application/vnd.api+json",
|
|
||||||
// "Accept": "application/vnd.api+json"
|
|
||||||
// },
|
|
||||||
// }
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user