Skip to content

Commit 1e767d5

Browse files
authored
Fix service enablement custom endpoint (#489)
* add service enablement custom endpoint * generate docs
1 parent 3c53079 commit 1e767d5

2 files changed

Lines changed: 70 additions & 60 deletions

File tree

docs/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ Note: AWS specific checks must be skipped as they do not work on STACKIT. For de
167167
- `service_account_key` (String) Service account key used for authentication. If set, the key flow will be used to authenticate all operations.
168168
- `service_account_key_path` (String) Path for the service account key used for authentication. If set, the key flow will be used to authenticate all operations.
169169
- `service_account_token` (String) Token used for authentication. If set, the token flow will be used to authenticate all operations.
170+
- `service_enablement_custom_endpoint` (String) Custom endpoint for the Service Enablement API
170171
- `ske_custom_endpoint` (String) Custom endpoint for the Kubernetes Engine (SKE) service
171172
- `sqlserverflex_custom_endpoint` (String) Custom endpoint for the SQL Server Flex service
172173
- `token_custom_endpoint` (String) Custom endpoint for the token API, which is used to request access tokens when using the key flow

stackit/provider.go

Lines changed: 69 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -79,71 +79,73 @@ func (p *Provider) Metadata(_ context.Context, _ provider.MetadataRequest, resp
7979
}
8080

8181
type providerModel struct {
82-
CredentialsFilePath types.String `tfsdk:"credentials_path"`
83-
ServiceAccountEmail types.String `tfsdk:"service_account_email"`
84-
ServiceAccountKey types.String `tfsdk:"service_account_key"`
85-
ServiceAccountKeyPath types.String `tfsdk:"service_account_key_path"`
86-
PrivateKey types.String `tfsdk:"private_key"`
87-
PrivateKeyPath types.String `tfsdk:"private_key_path"`
88-
Token types.String `tfsdk:"service_account_token"`
89-
Region types.String `tfsdk:"region"`
90-
ArgusCustomEndpoint types.String `tfsdk:"argus_custom_endpoint"`
91-
DNSCustomEndpoint types.String `tfsdk:"dns_custom_endpoint"`
92-
IaaSCustomEndpoint types.String `tfsdk:"iaas_custom_endpoint"`
93-
PostgreSQLCustomEndpoint types.String `tfsdk:"postgresql_custom_endpoint"`
94-
PostgresFlexCustomEndpoint types.String `tfsdk:"postgresflex_custom_endpoint"`
95-
MongoDBFlexCustomEndpoint types.String `tfsdk:"mongodbflex_custom_endpoint"`
96-
LoadBalancerCustomEndpoint types.String `tfsdk:"loadbalancer_custom_endpoint"`
97-
LogMeCustomEndpoint types.String `tfsdk:"logme_custom_endpoint"`
98-
RabbitMQCustomEndpoint types.String `tfsdk:"rabbitmq_custom_endpoint"`
99-
MariaDBCustomEndpoint types.String `tfsdk:"mariadb_custom_endpoint"`
100-
AuthorizationCustomEndpoint types.String `tfsdk:"authorization_custom_endpoint"`
101-
ObjectStorageCustomEndpoint types.String `tfsdk:"objectstorage_custom_endpoint"`
102-
OpenSearchCustomEndpoint types.String `tfsdk:"opensearch_custom_endpoint"`
103-
RedisCustomEndpoint types.String `tfsdk:"redis_custom_endpoint"`
104-
SecretsManagerCustomEndpoint types.String `tfsdk:"secretsmanager_custom_endpoint"`
105-
SQLServerFlexCustomEndpoint types.String `tfsdk:"sqlserverflex_custom_endpoint"`
106-
SKECustomEndpoint types.String `tfsdk:"ske_custom_endpoint"`
107-
ServerBackupCustomEndpoint types.String `tfsdk:"server_backup_custom_endpoint"`
108-
ResourceManagerCustomEndpoint types.String `tfsdk:"resourcemanager_custom_endpoint"`
109-
TokenCustomEndpoint types.String `tfsdk:"token_custom_endpoint"`
110-
JWKSCustomEndpoint types.String `tfsdk:"jwks_custom_endpoint"`
111-
EnableBetaResources types.Bool `tfsdk:"enable_beta_resources"`
82+
CredentialsFilePath types.String `tfsdk:"credentials_path"`
83+
ServiceAccountEmail types.String `tfsdk:"service_account_email"`
84+
ServiceAccountKey types.String `tfsdk:"service_account_key"`
85+
ServiceAccountKeyPath types.String `tfsdk:"service_account_key_path"`
86+
PrivateKey types.String `tfsdk:"private_key"`
87+
PrivateKeyPath types.String `tfsdk:"private_key_path"`
88+
Token types.String `tfsdk:"service_account_token"`
89+
Region types.String `tfsdk:"region"`
90+
ArgusCustomEndpoint types.String `tfsdk:"argus_custom_endpoint"`
91+
DNSCustomEndpoint types.String `tfsdk:"dns_custom_endpoint"`
92+
IaaSCustomEndpoint types.String `tfsdk:"iaas_custom_endpoint"`
93+
PostgreSQLCustomEndpoint types.String `tfsdk:"postgresql_custom_endpoint"`
94+
PostgresFlexCustomEndpoint types.String `tfsdk:"postgresflex_custom_endpoint"`
95+
MongoDBFlexCustomEndpoint types.String `tfsdk:"mongodbflex_custom_endpoint"`
96+
LoadBalancerCustomEndpoint types.String `tfsdk:"loadbalancer_custom_endpoint"`
97+
LogMeCustomEndpoint types.String `tfsdk:"logme_custom_endpoint"`
98+
RabbitMQCustomEndpoint types.String `tfsdk:"rabbitmq_custom_endpoint"`
99+
MariaDBCustomEndpoint types.String `tfsdk:"mariadb_custom_endpoint"`
100+
AuthorizationCustomEndpoint types.String `tfsdk:"authorization_custom_endpoint"`
101+
ObjectStorageCustomEndpoint types.String `tfsdk:"objectstorage_custom_endpoint"`
102+
OpenSearchCustomEndpoint types.String `tfsdk:"opensearch_custom_endpoint"`
103+
RedisCustomEndpoint types.String `tfsdk:"redis_custom_endpoint"`
104+
SecretsManagerCustomEndpoint types.String `tfsdk:"secretsmanager_custom_endpoint"`
105+
SQLServerFlexCustomEndpoint types.String `tfsdk:"sqlserverflex_custom_endpoint"`
106+
SKECustomEndpoint types.String `tfsdk:"ske_custom_endpoint"`
107+
ServerBackupCustomEndpoint types.String `tfsdk:"server_backup_custom_endpoint"`
108+
ResourceManagerCustomEndpoint types.String `tfsdk:"resourcemanager_custom_endpoint"`
109+
TokenCustomEndpoint types.String `tfsdk:"token_custom_endpoint"`
110+
JWKSCustomEndpoint types.String `tfsdk:"jwks_custom_endpoint"`
111+
EnableBetaResources types.Bool `tfsdk:"enable_beta_resources"`
112+
ServiceEnablementCustomEndpoint types.String `tfsdk:"service_enablement_custom_endpoint"`
112113
}
113114

114115
// Schema defines the provider-level schema for configuration data.
115116
func (p *Provider) Schema(_ context.Context, _ provider.SchemaRequest, resp *provider.SchemaResponse) {
116117
descriptions := map[string]string{
117-
"credentials_path": "Path of JSON from where the credentials are read. Takes precedence over the env var `STACKIT_CREDENTIALS_PATH`. Default value is `~/.stackit/credentials.json`.",
118-
"service_account_token": "Token used for authentication. If set, the token flow will be used to authenticate all operations.",
119-
"service_account_key_path": "Path for the service account key used for authentication. If set, the key flow will be used to authenticate all operations.",
120-
"service_account_key": "Service account key used for authentication. If set, the key flow will be used to authenticate all operations.",
121-
"private_key_path": "Path for the private RSA key used for authentication, relevant for the key flow. It takes precedence over the private key that is included in the service account key.",
122-
"private_key": "Private RSA key used for authentication, relevant for the key flow. It takes precedence over the private key that is included in the service account key.",
123-
"service_account_email": "Service account email. It can also be set using the environment variable STACKIT_SERVICE_ACCOUNT_EMAIL. It is required if you want to use the resource manager project resource.",
124-
"region": "Region will be used as the default location for regional services. Not all services require a region, some are global",
125-
"argus_custom_endpoint": "Custom endpoint for the Argus service",
126-
"dns_custom_endpoint": "Custom endpoint for the DNS service",
127-
"iaas_custom_endpoint": "Custom endpoint for the IaaS service",
128-
"mongodbflex_custom_endpoint": "Custom endpoint for the MongoDB Flex service",
129-
"loadbalancer_custom_endpoint": "Custom endpoint for the Load Balancer service",
130-
"logme_custom_endpoint": "Custom endpoint for the LogMe service",
131-
"rabbitmq_custom_endpoint": "Custom endpoint for the RabbitMQ service",
132-
"mariadb_custom_endpoint": "Custom endpoint for the MariaDB service",
133-
"authorization_custom_endpoint": "Custom endpoint for the Membership service",
134-
"objectstorage_custom_endpoint": "Custom endpoint for the Object Storage service",
135-
"opensearch_custom_endpoint": "Custom endpoint for the OpenSearch service",
136-
"postgresql_custom_endpoint": "Custom endpoint for the PostgreSQL service",
137-
"postgresflex_custom_endpoint": "Custom endpoint for the PostgresFlex service",
138-
"redis_custom_endpoint": "Custom endpoint for the Redis service",
139-
"server_backup_custom_endpoint": "Custom endpoint for the Server Backup service",
140-
"resourcemanager_custom_endpoint": "Custom endpoint for the Resource Manager service",
141-
"secretsmanager_custom_endpoint": "Custom endpoint for the Secrets Manager service",
142-
"sqlserverflex_custom_endpoint": "Custom endpoint for the SQL Server Flex service",
143-
"ske_custom_endpoint": "Custom endpoint for the Kubernetes Engine (SKE) service",
144-
"token_custom_endpoint": "Custom endpoint for the token API, which is used to request access tokens when using the key flow",
145-
"jwks_custom_endpoint": "Custom endpoint for the jwks API, which is used to get the json web key sets (jwks) to validate tokens when using the key flow",
146-
"enable_beta_resources": "Enable beta resources. Default is false.",
118+
"credentials_path": "Path of JSON from where the credentials are read. Takes precedence over the env var `STACKIT_CREDENTIALS_PATH`. Default value is `~/.stackit/credentials.json`.",
119+
"service_account_token": "Token used for authentication. If set, the token flow will be used to authenticate all operations.",
120+
"service_account_key_path": "Path for the service account key used for authentication. If set, the key flow will be used to authenticate all operations.",
121+
"service_account_key": "Service account key used for authentication. If set, the key flow will be used to authenticate all operations.",
122+
"private_key_path": "Path for the private RSA key used for authentication, relevant for the key flow. It takes precedence over the private key that is included in the service account key.",
123+
"private_key": "Private RSA key used for authentication, relevant for the key flow. It takes precedence over the private key that is included in the service account key.",
124+
"service_account_email": "Service account email. It can also be set using the environment variable STACKIT_SERVICE_ACCOUNT_EMAIL. It is required if you want to use the resource manager project resource.",
125+
"region": "Region will be used as the default location for regional services. Not all services require a region, some are global",
126+
"argus_custom_endpoint": "Custom endpoint for the Argus service",
127+
"dns_custom_endpoint": "Custom endpoint for the DNS service",
128+
"iaas_custom_endpoint": "Custom endpoint for the IaaS service",
129+
"mongodbflex_custom_endpoint": "Custom endpoint for the MongoDB Flex service",
130+
"loadbalancer_custom_endpoint": "Custom endpoint for the Load Balancer service",
131+
"logme_custom_endpoint": "Custom endpoint for the LogMe service",
132+
"rabbitmq_custom_endpoint": "Custom endpoint for the RabbitMQ service",
133+
"mariadb_custom_endpoint": "Custom endpoint for the MariaDB service",
134+
"authorization_custom_endpoint": "Custom endpoint for the Membership service",
135+
"objectstorage_custom_endpoint": "Custom endpoint for the Object Storage service",
136+
"opensearch_custom_endpoint": "Custom endpoint for the OpenSearch service",
137+
"postgresql_custom_endpoint": "Custom endpoint for the PostgreSQL service",
138+
"postgresflex_custom_endpoint": "Custom endpoint for the PostgresFlex service",
139+
"redis_custom_endpoint": "Custom endpoint for the Redis service",
140+
"server_backup_custom_endpoint": "Custom endpoint for the Server Backup service",
141+
"resourcemanager_custom_endpoint": "Custom endpoint for the Resource Manager service",
142+
"secretsmanager_custom_endpoint": "Custom endpoint for the Secrets Manager service",
143+
"sqlserverflex_custom_endpoint": "Custom endpoint for the SQL Server Flex service",
144+
"ske_custom_endpoint": "Custom endpoint for the Kubernetes Engine (SKE) service",
145+
"service_enablement_custom_endpoint": "Custom endpoint for the Service Enablement API",
146+
"token_custom_endpoint": "Custom endpoint for the token API, which is used to request access tokens when using the key flow",
147+
"jwks_custom_endpoint": "Custom endpoint for the jwks API, which is used to get the json web key sets (jwks) to validate tokens when using the key flow",
148+
"enable_beta_resources": "Enable beta resources. Default is false.",
147149
}
148150

149151
resp.Schema = schema.Schema{
@@ -256,6 +258,10 @@ func (p *Provider) Schema(_ context.Context, _ provider.SchemaRequest, resp *pro
256258
Optional: true,
257259
Description: descriptions["server_backup_custom_endpoint"],
258260
},
261+
"service_enablement_custom_endpoint": schema.StringAttribute{
262+
Optional: true,
263+
Description: descriptions["service_enablement_custom_endpoint"],
264+
},
259265
"token_custom_endpoint": schema.StringAttribute{
260266
Optional: true,
261267
Description: descriptions["token_custom_endpoint"],
@@ -365,6 +371,9 @@ func (p *Provider) Configure(ctx context.Context, req provider.ConfigureRequest,
365371
if !(providerConfig.SKECustomEndpoint.IsUnknown() || providerConfig.SKECustomEndpoint.IsNull()) {
366372
providerData.SKECustomEndpoint = providerConfig.SKECustomEndpoint.ValueString()
367373
}
374+
if !(providerConfig.ServiceEnablementCustomEndpoint.IsUnknown() || providerConfig.ServiceEnablementCustomEndpoint.IsNull()) {
375+
providerData.ServiceEnablementCustomEndpoint = providerConfig.ServiceEnablementCustomEndpoint.ValueString()
376+
}
368377
if !(providerConfig.TokenCustomEndpoint.IsUnknown() || providerConfig.TokenCustomEndpoint.IsNull()) {
369378
sdkConfig.TokenCustomUrl = providerConfig.TokenCustomEndpoint.ValueString()
370379
}

0 commit comments

Comments
 (0)