Skip to content

Commit c79ac2b

Browse files
committed
wip
1 parent 37e45eb commit c79ac2b

File tree

3 files changed

+26
-67
lines changed

3 files changed

+26
-67
lines changed

client/platform_config_azure.go

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

2525
type AzureServicePrincipalConfig struct {
26-
ClientId string `json:"clientId" tfsdk:"client_id"`
27-
Auth AzureServicePrincipalAuthConfig `json:"auth" tfsdk:"auth"`
28-
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"`
2929
}
3030

31-
type AzureServicePrincipalAuthConfig struct {
32-
Type string `json:"type" tfsdk:"type"`
33-
Credential *SecretEmbedded `json:"credential,omitempty" tfsdk:"credential"`
34-
WorkloadIdentity *struct{} `json:"workloadIdentity,omitempty" tfsdk:"workload_identity"`
31+
type AzureAuthConfig struct {
32+
Type string `json:"type" tfsdk:"type"`
33+
Credential *SecretEmbedded `json:"credential,omitempty" tfsdk:"credential"`
3534
}
3635

3736
type AzureGraphApiCredentials struct {
38-
ClientId string `json:"clientId" tfsdk:"client_id"`
39-
Auth AzureGraphApiAuthConfig `json:"auth" tfsdk:"auth"`
40-
}
41-
42-
type AzureGraphApiAuthConfig struct {
43-
Type string `json:"type" tfsdk:"type"`
44-
Credential *SecretEmbedded `json:"credential,omitempty" tfsdk:"credential"`
45-
WorkloadIdentity *struct{} `json:"workloadIdentity,omitempty" tfsdk:"workload_identity"`
37+
ClientId string `json:"clientId" tfsdk:"client_id"`
38+
Auth AzureAuthConfig `json:"auth" tfsdk:"auth"`
4639
}
4740

4841
type AzureSubscriptionProvisioningConfig struct {

client/platform_config_azurerg.go

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,14 @@ type AzureRgPlatformConfig struct {
66
}
77

88
type AzureRgReplicationConfig struct {
9-
ServicePrincipal AzureRgServicePrincipalConfig `json:"servicePrincipal" tfsdk:"service_principal"`
10-
Subscription string `json:"subscription" tfsdk:"subscription"`
11-
ResourceGroupNamePattern string `json:"resourceGroupNamePattern" tfsdk:"resource_group_name_pattern"`
12-
UserGroupNamePattern string `json:"userGroupNamePattern" tfsdk:"user_group_name_pattern"`
13-
B2bUserInvitation *AzureInviteB2BUserConfig `json:"b2bUserInvitation,omitempty" tfsdk:"b2b_user_invitation"`
14-
UserLookUpStrategy string `json:"userLookUpStrategy" tfsdk:"user_look_up_strategy"`
15-
TenantTags *MeshTenantTags `json:"tenantTags,omitempty" tfsdk:"tenant_tags"`
16-
SkipUserGroupPermissionCleanup bool `json:"skipUserGroupPermissionCleanup" tfsdk:"skip_user_group_permission_cleanup"`
17-
AdministrativeUnitId *string `json:"administrativeUnitId,omitempty" tfsdk:"administrative_unit_id"`
18-
AllowHierarchicalManagementGroupAssignment bool `json:"allowHierarchicalManagementGroupAssignment" tfsdk:"allow_hierarchical_management_group_assignment"`
19-
}
20-
21-
type AzureRgServicePrincipalConfig struct {
22-
ClientId string `json:"clientId" tfsdk:"client_id"`
23-
Auth AzureRgServicePrincipalAuthConfig `json:"auth" tfsdk:"auth"`
24-
ObjectId string `json:"objectId" tfsdk:"object_id"`
25-
}
26-
27-
type AzureRgServicePrincipalAuthConfig struct {
28-
Type string `json:"type" tfsdk:"type"`
29-
Credential *SecretEmbedded `json:"credential,omitempty" tfsdk:"credential"`
9+
ServicePrincipal AzureServicePrincipalConfig `json:"servicePrincipal" tfsdk:"service_principal"`
10+
Subscription string `json:"subscription" tfsdk:"subscription"`
11+
ResourceGroupNamePattern string `json:"resourceGroupNamePattern" tfsdk:"resource_group_name_pattern"`
12+
UserGroupNamePattern string `json:"userGroupNamePattern" tfsdk:"user_group_name_pattern"`
13+
B2bUserInvitation *AzureInviteB2BUserConfig `json:"b2bUserInvitation,omitempty" tfsdk:"b2b_user_invitation"`
14+
UserLookUpStrategy string `json:"userLookUpStrategy" tfsdk:"user_look_up_strategy"`
15+
TenantTags *MeshTenantTags `json:"tenantTags,omitempty" tfsdk:"tenant_tags"`
16+
SkipUserGroupPermissionCleanup bool `json:"skipUserGroupPermissionCleanup" tfsdk:"skip_user_group_permission_cleanup"`
17+
AdministrativeUnitId *string `json:"administrativeUnitId,omitempty" tfsdk:"administrative_unit_id"`
18+
AllowHierarchicalManagementGroupAssignment bool `json:"allowHierarchicalManagementGroupAssignment" tfsdk:"allow_hierarchical_management_group_assignment"`
3019
}

internal/provider/platform_data_source.go

Lines changed: 8 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -433,16 +433,7 @@ func azureMeteringConfigDataSourceSchema() schema.Attribute {
433433
MarkdownDescription: "Authentication type (credential or workloadIdentity)",
434434
Computed: true,
435435
},
436-
"credential": schema.StringAttribute{
437-
MarkdownDescription: "Client secret (if type is CREDENTIALS)",
438-
Computed: true,
439-
Sensitive: true,
440-
},
441-
"workload_identity": schema.SingleNestedAttribute{
442-
MarkdownDescription: "Workload identity configuration (if type is WORKLOAD_IDENTITY)",
443-
Computed: true,
444-
Attributes: map[string]schema.Attribute{},
445-
},
436+
"credential": secretEmbeddedDataSourceSchema("Client secret (if type is credential)"),
446437
},
447438
},
448439
"object_id": schema.StringAttribute{
@@ -616,11 +607,11 @@ func awsReplicationConfigDataSourceSchema() schema.Attribute {
616607
Computed: true,
617608
Attributes: map[string]schema.Attribute{
618609
"type": schema.StringAttribute{
619-
MarkdownDescription: "Authentication type (CREDENTIALS or WORKLOAD_IDENTITY)",
610+
MarkdownDescription: "Authentication type (credential or workloadIdentity)",
620611
Computed: true,
621612
},
622613
"credential": schema.SingleNestedAttribute{
623-
MarkdownDescription: "Service user credential configuration (if type is CREDENTIALS)",
614+
MarkdownDescription: "Service user credential configuration (if type is credential)",
624615
Computed: true,
625616
Attributes: map[string]schema.Attribute{
626617
"access_key": schema.StringAttribute{
@@ -631,7 +622,7 @@ func awsReplicationConfigDataSourceSchema() schema.Attribute {
631622
},
632623
},
633624
"workload_identity": schema.SingleNestedAttribute{
634-
MarkdownDescription: "Workload identity configuration (if type is WORKLOAD_IDENTITY)",
625+
MarkdownDescription: "Workload identity configuration (if type is workloadIdentity)",
635626
Computed: true,
636627
Attributes: map[string]schema.Attribute{
637628
"role_arn": schema.StringAttribute{
@@ -787,19 +778,10 @@ func azureReplicationConfigDataSourceSchema() schema.Attribute {
787778
Computed: true,
788779
Attributes: map[string]schema.Attribute{
789780
"type": schema.StringAttribute{
790-
MarkdownDescription: "Authentication type (CREDENTIALS or WORKLOAD_IDENTITY)",
791-
Computed: true,
792-
},
793-
"credential": schema.StringAttribute{
794-
MarkdownDescription: "Client secret (if type is CREDENTIALS)",
795-
Computed: true,
796-
Sensitive: true,
797-
},
798-
"workload_identity": schema.SingleNestedAttribute{
799-
MarkdownDescription: "Workload identity configuration (if type is WORKLOAD_IDENTITY)",
781+
MarkdownDescription: "Authentication type (credential or workloadIdentity)",
800782
Computed: true,
801-
Attributes: map[string]schema.Attribute{},
802783
},
784+
"credential": secretEmbeddedDataSourceSchema("Client secret (if type is credential)"),
803785
},
804786
},
805787
"object_id": schema.StringAttribute{
@@ -856,19 +838,14 @@ func azureReplicationConfigDataSourceSchema() schema.Attribute {
856838
Computed: true,
857839
Attributes: map[string]schema.Attribute{
858840
"type": schema.StringAttribute{
859-
MarkdownDescription: "Must be one of CREDENTIALS or WORKLOAD_IDENTITY. Workload Identity Federation is the one that we recommend as it enables the most secure approach to provide access to your Azure tenant without using long lived credentials. Credential Authentication is an alternative approach where you have to provide a clientSecret manually to meshStack and meshStack stores it encrypted.",
841+
MarkdownDescription: "Must be one of credential or workloadIdentity. Workload Identity Federation is the one that we recommend as it enables the most secure approach to provide access to your Azure tenant without using long lived credentials. Credential Authentication is an alternative approach where you have to provide a clientSecret manually to meshStack and meshStack stores it encrypted.",
860842
Computed: true,
861843
},
862844
"credential": schema.StringAttribute{
863-
MarkdownDescription: "Must be set if and only if type is CREDENTIALS. A valid secret for accessing the application. In Azure Portal, this can be configured on the \"App Registration\" under Certificates & secrets. [How is this information secured?](https://docs.meshcloud.io/operations/security-faq/#how-does-meshstack-securely-handle-my-cloud-platform-credentials)",
845+
MarkdownDescription: "Must be set if and only if type is credential. A valid secret for accessing the application. In Azure Portal, this can be configured on the \"App Registration\" under Certificates & secrets. [How is this information secured?](https://docs.meshcloud.io/operations/security-faq/#how-does-meshstack-securely-handle-my-cloud-platform-credentials)",
864846
Computed: true,
865847
Sensitive: true,
866848
},
867-
"workload_identity": schema.SingleNestedAttribute{
868-
MarkdownDescription: "Workload identity configuration (if type is WORKLOAD_IDENTITY)",
869-
Computed: true,
870-
Attributes: map[string]schema.Attribute{},
871-
},
872849
},
873850
},
874851
},

0 commit comments

Comments
 (0)