WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 68d006a

Browse files
committed
refactor: reduce code duplication
1 parent 06a39bb commit 68d006a

File tree

9 files changed

+123
-244
lines changed

9 files changed

+123
-244
lines changed

CHANGELOG.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
## v0.15.1
22

3-
FIXES:
4-
5-
- Changes to meshPlatform API.
3+
FEATURES:
64

5+
- Restructured `meshstack_platform` authentication configuration for all platforms.
6+
- Renamed fields: `user_look_up_strategy``user_lookup_strategy`, `service_account_config``service_account`.
7+
- Secrets now use nested `plaintext` field within credential objects.
78
## v0.15.0
89

910
FEATURES:

docs/data-sources/platform.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ Read-Only:
648648
- `subscription` (String) The Subscription that will contain all the created Resource Groups. Once you set the Subscription, you must not change it.
649649
- `tenant_tags` (Attributes) Tenant tags configuration (see [below for nested schema](#nestedatt--spec--config--azurerg--replication--tenant_tags))
650650
- `user_group_name_pattern` (String) Configures the pattern that defines the desired name of AAD groups managed by meshStack. It follows the usual replicator string pattern features and provides the additional replacement 'platformGroupAlias', which contains the role name suffix. This suffix is configurable via Role Mappings in this platform config.
651-
- `user_lookup_strategy` (String) User lookup strategy (`userPrincipalName` or `email`). Users can either be looked up in cloud platforms by email or UPN (User Principal Name). In most cases email is the matching way as it is the only identifier that is consistently used throughout all cloud platforms and meshStack.
651+
- `user_lookup_strategy` (String) User lookup strategy (`UserByMailLookupStrategy` or `UserByUsernameLookupStrategy`). Users can either be looked up in cloud platforms by email or UPN (User Principal Name). In most cases email is the matching way as it is the only identifier that is consistently used throughout all cloud platforms and meshStack.
652652

653653
<a id="nestedatt--spec--config--azurerg--replication--b2b_user_invitation"></a>
654654
### Nested Schema for `spec.config.azurerg.replication.b2b_user_invitation`

docs/resources/platform.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,11 @@ Read-Only:
237237

238238
Required:
239239

240-
- `base_url` (String) Base URL of the AKS cluster
240+
- `base_url` (String) This is the base URL to your AKS cluster, which is used to call the APIs to create new AKS tenants, get raw data for metering the AKS tenants, etc. An example base URL is: https://myaks-dns.westeurope.azmk8s.io:443
241241

242242
Optional:
243243

244-
- `disable_ssl_validation` (Boolean) Flag to disable SSL validation for the AKS cluster. (SSL Validation should at best never be disabled, but for integration of some private cloud platforms in an early state, they might not yet be using valid SSL certificates. In that case it can make sense to disable SSL validation here to already test integration of these platforms.)
244+
- `disable_ssl_validation` (Boolean) Flag to disable SSL validation for the AKS cluster. SSL Validation should at best never be disabled, but for integration of some private cloud platforms in an early state, they might not yet be using valid SSL certificates. In that case it can make sense to disable SSL validation here to already test integration of these platforms.
245245
- `metering` (Attributes) Metering configuration for AKS (optional, but required for metering) (see [below for nested schema](#nestedatt--spec--config--aks--metering))
246246
- `replication` (Attributes) Replication configuration for AKS (optional, but required for replication) (see [below for nested schema](#nestedatt--spec--config--aks--replication))
247247

@@ -292,7 +292,7 @@ Required:
292292
- `namespace_name_pattern` (String) Pattern for naming namespaces in AKS
293293
- `send_azure_invitation_mail` (Boolean) Flag to send Azure invitation emails. When true, meshStack instructs Azure to send out Invitation mails to invited users.
294294
- `service_principal` (Attributes) Service principal configuration for AKS (see [below for nested schema](#nestedatt--spec--config--aks--replication--service_principal))
295-
- `user_lookup_strategy` (String) Strategy for user lookup in Azure (`userPrincipalName` or `email`)
295+
- `user_lookup_strategy` (String) Strategy for user lookup in Azure (`UserByMailLookupStrategy` or `UserByUsernameLookupStrategy`)
296296

297297
Optional:
298298

@@ -404,7 +404,7 @@ Required:
404404
<a id="nestedatt--spec--config--aws--metering--access_config--auth--workload_identity"></a>
405405
### Nested Schema for `spec.config.aws.metering.access_config.auth.workload_identity`
406406

407-
Read-Only:
407+
Required:
408408

409409
- `role_arn` (String) ARN of the role that should be used as the entry point for meshStack by assuming it via web identity.
410410

@@ -488,7 +488,7 @@ Required:
488488
<a id="nestedatt--spec--config--aws--replication--access_config--auth--workload_identity"></a>
489489
### Nested Schema for `spec.config.aws.replication.access_config.auth.workload_identity`
490490

491-
Read-Only:
491+
Required:
492492

493493
- `role_arn` (String) ARN of the role that should be used as the entry point for meshStack by assuming it via web identity.
494494

@@ -558,7 +558,7 @@ Required:
558558

559559
Required:
560560

561-
- `namespace_prefix` (String) Namespace prefix for tenant tags
561+
- `namespace_prefix` (String) This is the prefix for all labels created by meshStack. It helps to keep track of which labels are managed by meshStack. It is recommended to let this prefix end with a delimiter like an underscore.
562562

563563
Optional:
564564

@@ -648,15 +648,15 @@ Required:
648648
- `service_principal` (Attributes) Service principal configuration for Azure (see [below for nested schema](#nestedatt--spec--config--azure--replication--service_principal))
649649
- `skip_user_group_permission_cleanup` (Boolean) Flag to skip user group permission cleanup. For certain use cases you might want to preserve user groups and replicated permission after a tenant was deleted on the Azure platform. Checking this option preserves those permissions. Please keep in mind that the platform operator is then responsible for cleaning them up later.
650650
- `subscription_name_pattern` (String) Configures the pattern that defines the desired name of Azure Subscriptions managed by meshStack.
651-
- `user_lookup_strategy` (String) User lookup strategy (`userPrincipalName` or `email`). Users can either be looked up in cloud platforms by email or UPN (User Principal Name). In most cases email is the matching way as it is the only identifier that is consistently used throughout all cloud platforms and meshStack.
651+
- `user_lookup_strategy` (String) Strategy for user lookup in Azure (`UserByMailLookupStrategy` or `UserByUsernameLookupStrategy`)
652652

653653
Optional:
654654

655655
- `administrative_unit_id` (String) If you enter an administrative unit ID the replicated (and potentially existing) groups will be put into this AU. This can be used to limit the permission scopes which are required for the replicator principal. If you remove the AU ID again or change it, the groups will not be removed from the old AU.
656656
- `b2b_user_invitation` (Attributes) Optional B2B user invitation configuration. When configured, instructs the replicator to create AAD B2B guest invitations for users missing in the AAD tenant managed by this meshPlatform. (see [below for nested schema](#nestedatt--spec--config--azure--replication--b2b_user_invitation))
657657
- `blueprint_location` (String) The Azure location where replication creates and updates Blueprint Assignments. Note that it's still possible that the Blueprint creates resources in other locations, this is merely the location where the Blueprint Assignment is managed.
658658
- `provisioning` (Attributes) To provide Azure Subscription for your organization's meshProjects, meshcloud supports using Enterprise Enrollment or allocating from a pool of pre-provisioned subscriptions. One of the subFields enterpriseEnrollment, customerAgreement or preProvisioned must be provided! (see [below for nested schema](#nestedatt--spec--config--azure--replication--provisioning))
659-
- `tenant_tags` (Attributes) Tenant tagging configuration. (see [below for nested schema](#nestedatt--spec--config--azure--replication--tenant_tags))
659+
- `tenant_tags` (Attributes) Tenant tags configuration (see [below for nested schema](#nestedatt--spec--config--azure--replication--tenant_tags))
660660

661661
<a id="nestedatt--spec--config--azure--replication--azure_role_mappings"></a>
662662
### Nested Schema for `spec.config.azure.replication.azure_role_mappings`
@@ -849,7 +849,7 @@ Required:
849849
- `skip_user_group_permission_cleanup` (Boolean) For certain use cases you might want to preserve user groups and replicated permission after a tenant was deleted on the Azure platform. Checking this option preserves those permissions. Please keep in mind that the platform operator is then responsible for cleaning them up later.
850850
- `subscription` (String) The Subscription that will contain all the created Resource Groups. Once you set the Subscription, you must not change it.
851851
- `user_group_name_pattern` (String) Configures the pattern that defines the desired name of AAD groups managed by meshStack. It follows the usual replicator string pattern features and provides the additional replacement 'platformGroupAlias', which contains the role name suffix. This suffix is configurable via Role Mappings in this platform config.
852-
- `user_lookup_strategy` (String) User lookup strategy (`userPrincipalName` or `email`). Users can either be looked up in cloud platforms by email or UPN (User Principal Name). In most cases email is the matching way as it is the only identifier that is consistently used throughout all cloud platforms and meshStack.
852+
- `user_lookup_strategy` (String) Strategy for user lookup in Azure (`UserByMailLookupStrategy` or `UserByUsernameLookupStrategy`)
853853

854854
Optional:
855855

@@ -1061,7 +1061,7 @@ Required:
10611061

10621062
Required:
10631063

1064-
- `namespace_prefix` (String) Namespace prefix for tenant tags
1064+
- `namespace_prefix` (String) This is the prefix for all labels created by meshStack. It helps to keep track of which labels are managed by meshStack. It is recommended to let this prefix end with a delimiter like an underscore.
10651065

10661066
Optional:
10671067

@@ -1084,7 +1084,7 @@ Required:
10841084

10851085
Required:
10861086

1087-
- `base_url` (String) This URL is the base URL to your Kubernetes Cluster, which is used to call the APIs to create new Kubernetes projects, get raw data for metering the Kubernetes projects, etc. An example base URL is: https://k8s.dev.eu-de-central.msh.host:6443
1087+
- `base_url` (String) This is the base URL to your Kubernetes cluster, which is used to call the APIs to create new Kubernetes tenants, get raw data for metering the Kubernetes tenants, etc. An example base URL is: https://k8s.dev.eu-de-central.msh.host:6443
10881088

10891089
Optional:
10901090

@@ -1157,7 +1157,7 @@ Required:
11571157

11581158
Required:
11591159

1160-
- `base_url` (String) This URL is the base URL to your OpenShift Cluster, which is used to call the APIs to create new OpenShift projects, get raw data for metering the OpenShift projects, etc. An example base URL is: https://api.okd4.dev.eu-de-central.msh.host:6443
1160+
- `base_url` (String) This is the base URL to your OpenShift cluster, which is used to call the APIs to create new OpenShift tenants, get raw data for metering the OpenShift tenants, etc. An example base URL is: https://api.okd4.dev.eu-de-central.msh.host:6443
11611161

11621162
Optional:
11631163

internal/provider/platform_data_source.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -982,9 +982,8 @@ func azureRgReplicationConfigDataSourceSchema() schema.Attribute {
982982
},
983983
},
984984
},
985-
// TODO: enforce correct value
986985
"user_lookup_strategy": schema.StringAttribute{
987-
MarkdownDescription: "User lookup strategy (`userPrincipalName` or `email`). Users can either be looked up in cloud platforms by email or UPN (User Principal Name). In most cases email is the matching way as it is the only identifier that is consistently used throughout all cloud platforms and meshStack.",
986+
MarkdownDescription: "User lookup strategy (`UserByMailLookupStrategy` or `UserByUsernameLookupStrategy`). Users can either be looked up in cloud platforms by email or UPN (User Principal Name). In most cases email is the matching way as it is the only identifier that is consistently used throughout all cloud platforms and meshStack.",
988987
Computed: true,
989988
},
990989
"tenant_tags": schema.SingleNestedAttribute{

internal/provider/platform_resource_schema_aws.go

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func awsAccessConfigSchema() schema.Attribute {
6060
Attributes: map[string]schema.Attribute{
6161
"role_arn": schema.StringAttribute{
6262
MarkdownDescription: "ARN of the role that should be used as the entry point for meshStack by assuming it via web identity.",
63-
Computed: true,
63+
Required: true,
6464
},
6565
},
6666
},
@@ -127,32 +127,7 @@ func awsReplicationConfigSchema() schema.Attribute {
127127
MarkdownDescription: "With a String Pattern you can define how the account email address of the created AWS account will be set. E.g. `aws+#{workspaceIdentifier}.#{projectIdentifier}@yourcompany.com`. Please consider that this email address is limited to 64 characters! Also have a look at our docs for more information.",
128128
Required: true,
129129
},
130-
"tenant_tags": schema.SingleNestedAttribute{
131-
MarkdownDescription: "Tenant tags configuration",
132-
Optional: true,
133-
Attributes: map[string]schema.Attribute{
134-
"namespace_prefix": schema.StringAttribute{
135-
MarkdownDescription: "Namespace prefix for tenant tags",
136-
Required: true,
137-
},
138-
"tag_mappers": schema.ListNestedAttribute{
139-
MarkdownDescription: "List of tag mappers for tenant tags",
140-
Optional: true,
141-
NestedObject: schema.NestedAttributeObject{
142-
Attributes: map[string]schema.Attribute{
143-
"key": schema.StringAttribute{
144-
MarkdownDescription: "Key for the tag mapper",
145-
Required: true,
146-
},
147-
"value_pattern": schema.StringAttribute{
148-
MarkdownDescription: "Value pattern for the tag mapper",
149-
Required: true,
150-
},
151-
},
152-
},
153-
},
154-
},
155-
},
130+
"tenant_tags": tenantTagsAttribute(),
156131
"aws_sso": schema.SingleNestedAttribute{
157132
MarkdownDescription: "AWS SSO configuration",
158133
Optional: true,

0 commit comments

Comments
 (0)