Improve terraform-cloud secret sync destination variables

This commit is contained in:
carlosmonastyrski
2025-04-10 07:38:11 -03:00
parent 68374a17f0
commit a84dddaf6f
10 changed files with 62 additions and 50 deletions
@@ -1,3 +1,4 @@
import { TerraformCloudSyncScope } from "@app/hooks/api/appConnections/terraform-cloud";
import { SecretSync, TSecretSync } from "@app/hooks/api/secretSyncs";
import {
GitHubSyncScope,
@@ -75,7 +76,11 @@ export const getSecretSyncDestinationColValues = (secretSync: TSecretSync) => {
break;
case SecretSync.TerraformCloud:
primaryText = destinationConfig.org;
secondaryText = destinationConfig.destinationName;
if (destinationConfig.scope === TerraformCloudSyncScope.VariableSet) {
secondaryText = destinationConfig.variableSetName;
} else {
secondaryText = destinationConfig.workspaceName;
}
break;
default:
throw new Error(`Unhandled Destination Col Values ${destination}`);
@@ -20,7 +20,7 @@ export const TerraformCloudSyncDestinationSection = ({ secretSync }: Props) => {
<>
<GenericFieldLabel label="Organization">{destinationConfig.org}</GenericFieldLabel>
<GenericFieldLabel label="Variable Set">
{destinationConfig.destinationName}
{destinationConfig.variableSetName}
</GenericFieldLabel>
</>
);
@@ -29,9 +29,7 @@ export const TerraformCloudSyncDestinationSection = ({ secretSync }: Props) => {
Components = (
<>
<GenericFieldLabel label="Organization">{destinationConfig.org}</GenericFieldLabel>
<GenericFieldLabel label="Workspace">
{destinationConfig.destinationName}
</GenericFieldLabel>
<GenericFieldLabel label="Workspace">{destinationConfig.workspaceName}</GenericFieldLabel>
</>
);
break;