Skip to content

Commit 4d2d3dd

Browse files
committed
fix: upstream api changed secret handling
1 parent 2f12f00 commit 4d2d3dd

15 files changed

+319
-341
lines changed

client/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func (c *MeshStackProviderClient) login() error {
111111
if err != nil {
112112
return err
113113
} else if res.StatusCode != 200 {
114-
return errors.New(fmt.Sprintf("Status %d: %s", res.StatusCode, ERROR_AUTHENTICATION_FAILURE))
114+
return fmt.Errorf("Status %d: %s", res.StatusCode, ERROR_AUTHENTICATION_FAILURE)
115115
}
116116

117117
defer res.Body.Close()

client/platform.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ type MeshPlatformSpec struct {
3939
QuotaDefinitions []QuotaDefinition `json:"quotaDefinitions" tfsdk:"quota_definitions"`
4040
}
4141

42+
type SecretEmbedded struct {
43+
Plaintext *string `json:"plaintext,omitempty" tfsdk:"plaintext"`
44+
// TODO: add Hash field
45+
}
46+
4247
type QuotaDefinition struct {
4348
QuotaKey string `json:"quotaKey" tfsdk:"quota_key"`
4449
MinValue int `json:"minValue" tfsdk:"min_value"`

client/platform_config_aks.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ type AksPlatformConfig struct {
88
}
99

1010
type AksReplicationConfig struct {
11-
AccessToken string `json:"accessToken" tfsdk:"access_token"`
11+
AccessToken SecretEmbedded `json:"accessToken" tfsdk:"access_token"`
1212
NamespaceNamePattern string `json:"namespaceNamePattern" tfsdk:"namespace_name_pattern"`
1313
GroupNamePattern string `json:"groupNamePattern" tfsdk:"group_name_pattern"`
1414
ServicePrincipal AksServicePrincipalConfig `json:"servicePrincipal" tfsdk:"service_principal"`
@@ -22,11 +22,10 @@ type AksReplicationConfig struct {
2222
}
2323

2424
type AksServicePrincipalConfig struct {
25-
ClientId string `json:"clientId" tfsdk:"client_id"`
26-
AuthType string `json:"authType" tfsdk:"auth_type"`
27-
CredentialsAuthClientSecret *string `json:"credentialsAuthClientSecret,omitempty" tfsdk:"credentials_auth_client_secret"`
28-
EntraTenant string `json:"entraTenant" tfsdk:"entra_tenant"`
29-
ObjectId string `json:"objectId" tfsdk:"object_id"`
25+
EntraTenant string `json:"entraTenant" tfsdk:"entra_tenant"`
26+
ObjectId string `json:"objectId" tfsdk:"object_id"`
27+
ClientId string `json:"clientId" tfsdk:"client_id"`
28+
Auth AzureAuthConfig `json:"auth" tfsdk:"auth"`
3029
}
3130

3231
type AksMeteringConfig struct {

client/platform_config_aws.go

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,31 @@ type AwsReplicationConfig struct {
2424
}
2525

2626
type AwsAccessConfig struct {
27-
OrganizationRootAccountRole string `json:"organizationRootAccountRole" tfsdk:"organization_root_account_role"`
28-
OrganizationRootAccountExternalId *string `json:"organizationRootAccountExternalId,omitempty" tfsdk:"organization_root_account_external_id"`
29-
ServiceUserConfig *AwsServiceUserConfig `json:"serviceUserConfig,omitempty" tfsdk:"service_user_config"`
30-
WorkloadIdentityConfig *AwsWorkloadIdentityConfig `json:"workloadIdentityConfig,omitempty" tfsdk:"workload_identity_config"`
27+
OrganizationRootAccountRole string `json:"organizationRootAccountRole" tfsdk:"organization_root_account_role"`
28+
OrganizationRootAccountExternalId *string `json:"organizationRootAccountExternalId,omitempty" tfsdk:"organization_root_account_external_id"`
29+
Auth AwsAuth `json:"auth" tfsdk:"auth"`
3130
}
3231

33-
type AwsServiceUserConfig struct {
34-
AccessKey string `json:"accessKey" tfsdk:"access_key"`
35-
SecretKey string `json:"secretKey" tfsdk:"secret_key"`
32+
type AwsAuth struct {
33+
Type string `json:"type" tfsdk:"type"`
34+
Credential *AwsServiceUserCredential `json:"credential,omitempty" tfsdk:"credential"`
35+
WorkloadIdentity *AwsWorkloadIdentityCredential `json:"workloadIdentity,omitempty" tfsdk:"workload_identity"`
3636
}
3737

38-
type AwsWorkloadIdentityConfig struct {
38+
type AwsServiceUserCredential struct {
39+
AccessKey string `json:"accessKey" tfsdk:"access_key"`
40+
SecretKey SecretEmbedded `json:"secretKey" tfsdk:"secret_key"`
41+
}
42+
43+
type AwsWorkloadIdentityCredential struct {
3944
RoleArn string `json:"roleArn" tfsdk:"role_arn"`
4045
}
4146

4247
type AwsSsoConfig struct {
4348
ScimEndpoint string `json:"scimEndpoint" tfsdk:"scim_endpoint"`
4449
Arn string `json:"arn" tfsdk:"arn"`
4550
GroupNamePattern string `json:"groupNamePattern" tfsdk:"group_name_pattern"`
46-
SsoAccessToken string `json:"ssoAccessToken" tfsdk:"sso_access_token"`
51+
SsoAccessToken SecretEmbedded `json:"ssoAccessToken" tfsdk:"sso_access_token"`
4752
AwsRoleMappings []AwsSsoRoleMapping `json:"awsRoleMappings" tfsdk:"aws_role_mappings"`
4853
SignInUrl string `json:"signInUrl" tfsdk:"sign_in_url"`
4954
}

client/platform_config_azure.go

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,19 @@ type AzureReplicationConfig struct {
2323
}
2424

2525
type AzureServicePrincipalConfig struct {
26-
ClientId string `json:"clientId" tfsdk:"client_id"`
27-
AuthType string `json:"authType" tfsdk:"auth_type"`
28-
CredentialsAuthClientSecret *string `json:"credentialsAuthClientSecret,omitempty" tfsdk:"credentials_auth_client_secret"`
29-
ObjectId string `json:"objectId" tfsdk:"object_id"`
26+
ClientId string `json:"clientId" tfsdk:"client_id"`
27+
ObjectId string `json:"objectId" tfsdk:"object_id"`
28+
Auth AzureAuthConfig `json:"auth" tfsdk:"auth"`
29+
}
30+
31+
type AzureAuthConfig struct {
32+
Type string `json:"type" tfsdk:"type"`
33+
Credential *SecretEmbedded `json:"credential,omitempty" tfsdk:"credential"`
3034
}
3135

3236
type AzureGraphApiCredentials struct {
33-
ClientId string `json:"clientId" tfsdk:"client_id"`
34-
AuthType string `json:"authType" tfsdk:"auth_type"`
35-
CredentialsAuthClientSecret *string `json:"credentialsAuthClientSecret,omitempty" tfsdk:"credentials_auth_client_secret"`
37+
ClientId string `json:"clientId" tfsdk:"client_id"`
38+
Auth AzureAuthConfig `json:"auth" tfsdk:"auth"`
3639
}
3740

3841
type AzureSubscriptionProvisioningConfig struct {

client/platform_config_gcp.go

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ type GcpPlatformConfig struct {
66
}
77

88
type GcpReplicationConfig struct {
9-
ServiceAccountConfig GcpServiceAccountConfig `json:"serviceAccountConfig" tfsdk:"service_account_config"`
9+
ServiceAccount GcpServiceAccountConfig `json:"serviceAccount" tfsdk:"service_account"`
1010
Domain string `json:"domain" tfsdk:"domain"`
1111
CustomerId string `json:"customerId" tfsdk:"customer_id"`
1212
GroupNamePattern string `json:"groupNamePattern" tfsdk:"group_name_pattern"`
@@ -22,12 +22,9 @@ type GcpReplicationConfig struct {
2222
}
2323

2424
type GcpServiceAccountConfig struct {
25-
ServiceAccountCredentialsConfig *GcpServiceAccountCredentialsConfig `json:"serviceAccountCredentialsConfig,omitempty" tfsdk:"service_account_credentials_config"`
26-
ServiceAccountWorkloadIdentityConfig *GcpServiceAccountWorkloadIdentityConfig `json:"serviceAccountWorkloadIdentityConfig,omitempty" tfsdk:"service_account_workload_identity_config"`
27-
}
28-
29-
type GcpServiceAccountCredentialsConfig struct {
30-
ServiceAccountCredentialsB64 string `json:"serviceAccountCredentialsB64" tfsdk:"service_account_credentials_b64"`
25+
Type string `json:"type" tfsdk:"type"`
26+
Credential *SecretEmbedded `json:"credential,omitempty" tfsdk:"credential"`
27+
WorkloadIdentity *GcpServiceAccountWorkloadIdentityConfig `json:"workloadIdentity,omitempty" tfsdk:"workload_identity"`
3128
}
3229

3330
type GcpServiceAccountWorkloadIdentityConfig struct {
@@ -41,7 +38,7 @@ type GcpPlatformRoleMapping struct {
4138
}
4239

4340
type GcpMeteringConfig struct {
44-
ServiceAccountConfig GcpServiceAccountConfig `json:"serviceAccountConfig" tfsdk:"service_account_config"`
41+
ServiceAccount GcpServiceAccountConfig `json:"serviceAccount" tfsdk:"service_account"`
4542
BigqueryTable string `json:"bigqueryTable" tfsdk:"bigquery_table"`
4643
BigqueryTableForCarbonFootprint *string `json:"bigqueryTableForCarbonFootprint,omitempty" tfsdk:"bigquery_table_for_carbon_footprint"`
4744
CarbonFootprintDataCollectionStartMonth *string `json:"carbonFootprintDataCollectionStartMonth,omitempty" tfsdk:"carbon_footprint_data_collection_start_month"`

client/platform_config_kubernetes.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ type KubernetesReplicationConfig struct {
1313
}
1414

1515
type KubernetesClientConfig struct {
16-
AccessToken string `json:"accessToken" tfsdk:"access_token"`
16+
AccessToken SecretEmbedded `json:"accessToken" tfsdk:"access_token"`
1717
}
1818

1919
type KubernetesMeteringConfig struct {

client/platform_config_openshift.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ type OpenShiftReplicationConfig struct {
1212
WebConsoleUrl *string `json:"webConsoleUrl,omitempty" tfsdk:"web_console_url"`
1313
ProjectNamePattern string `json:"projectNamePattern" tfsdk:"project_name_pattern"`
1414
EnableTemplateInstantiation bool `json:"enableTemplateInstantiation" tfsdk:"enable_template_instantiation"`
15-
OpenShiftRoleMappings []OpenShiftPlatformRoleMapping `json:"openshiftRoleMappings" tfsdk:"openshift_role_mappings"`
15+
OpenshiftRoleMappings []OpenShiftPlatformRoleMapping `json:"openshiftRoleMappings" tfsdk:"openshift_role_mappings"`
1616
IdentityProviderName string `json:"identityProviderName" tfsdk:"identity_provider_name"`
1717
TenantTags *MeshTenantTags `json:"tenantTags,omitempty" tfsdk:"tenant_tags"`
1818
}
@@ -24,5 +24,5 @@ type OpenShiftMeteringConfig struct {
2424

2525
type OpenShiftPlatformRoleMapping struct {
2626
MeshProjectRoleRef MeshProjectRoleRefV2 `json:"projectRoleRef" tfsdk:"project_role_ref"`
27-
OpenShiftRole string `json:"openshiftRole" tfsdk:"openshift_role"`
27+
OpenshiftRole string `json:"openshiftRole" tfsdk:"openshift_role"`
2828
}

0 commit comments

Comments
 (0)