mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
set all new and existing secrets to be sensitive: true
This commit is contained in:
@@ -3075,7 +3075,7 @@ const syncSecretsTerraformCloud = async ({
|
|||||||
}) => {
|
}) => {
|
||||||
// get secrets from Terraform Cloud
|
// get secrets from Terraform Cloud
|
||||||
const terraformSecrets = (
|
const terraformSecrets = (
|
||||||
await request.get<{ data: { attributes: { key: string; value: string }; id: string }[] }>(
|
await request.get<{ data: { attributes: { key: string; value: string; sensitive: boolean }; id: string }[] }>(
|
||||||
`${IntegrationUrls.TERRAFORM_CLOUD_API_URL}/api/v2/workspaces/${integration.appId}/vars`,
|
`${IntegrationUrls.TERRAFORM_CLOUD_API_URL}/api/v2/workspaces/${integration.appId}/vars`,
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
@@ -3089,7 +3089,7 @@ const syncSecretsTerraformCloud = async ({
|
|||||||
...obj,
|
...obj,
|
||||||
[secret.attributes.key]: secret
|
[secret.attributes.key]: secret
|
||||||
}),
|
}),
|
||||||
{} as Record<string, { attributes: { key: string; value: string }; id: string }>
|
{} as Record<string, { attributes: { key: string; value: string; sensitive: boolean }; id: string }>
|
||||||
);
|
);
|
||||||
|
|
||||||
const secretsToAdd: { [key: string]: string } = {};
|
const secretsToAdd: { [key: string]: string } = {};
|
||||||
@@ -3170,7 +3170,8 @@ const syncSecretsTerraformCloud = async ({
|
|||||||
attributes: {
|
attributes: {
|
||||||
key,
|
key,
|
||||||
value: secrets[key]?.value,
|
value: secrets[key]?.value,
|
||||||
category: integration.targetService
|
category: integration.targetService,
|
||||||
|
sensitive: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -3183,7 +3184,11 @@ const syncSecretsTerraformCloud = async ({
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
// case: secret exists in Terraform Cloud
|
// case: secret exists in Terraform Cloud
|
||||||
} else if (secrets[key]?.value !== terraformSecrets[key].attributes.value) {
|
} else if (
|
||||||
|
// we now set secrets to sensitive in Terraform Cloud, this checks if existing secrets are not sensitive and updates them accordingly
|
||||||
|
!terraformSecrets[key].attributes.sensitive ||
|
||||||
|
secrets[key]?.value !== terraformSecrets[key].attributes.value
|
||||||
|
) {
|
||||||
// -> update secret
|
// -> update secret
|
||||||
await request.patch(
|
await request.patch(
|
||||||
`${IntegrationUrls.TERRAFORM_CLOUD_API_URL}/api/v2/workspaces/${integration.appId}/vars/${terraformSecrets[key].id}`,
|
`${IntegrationUrls.TERRAFORM_CLOUD_API_URL}/api/v2/workspaces/${integration.appId}/vars/${terraformSecrets[key].id}`,
|
||||||
@@ -3193,7 +3198,8 @@ const syncSecretsTerraformCloud = async ({
|
|||||||
id: terraformSecrets[key].id,
|
id: terraformSecrets[key].id,
|
||||||
attributes: {
|
attributes: {
|
||||||
...terraformSecrets[key],
|
...terraformSecrets[key],
|
||||||
value: secrets[key]?.value
|
value: secrets[key]?.value,
|
||||||
|
sensitive: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user