Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/guides/ske_log_alerts.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This guide walks you through setting up log-based alerting in STACKIT Observabil

```hcl
provider "stackit" {
Comment thread
SerseusWasTaken marked this conversation as resolved.
region = "eu01"
default_region = "eu01"
}
provider "kubernetes" {
Expand Down Expand Up @@ -196,4 +196,4 @@ This guide walks you through setting up log-based alerting in STACKIT Observabil
}
}
}
```
```
1 change: 0 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ See this [example](https://professional-service.git.onstackit.cloud/professional
- `private_key_path` (String) 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.
- `rabbitmq_custom_endpoint` (String) Custom endpoint for the RabbitMQ service
- `redis_custom_endpoint` (String) Custom endpoint for the Redis service
- `region` (String, Deprecated) Region will be used as the default location for regional services. Not all services require a region, some are global
- `resourcemanager_custom_endpoint` (String) Custom endpoint for the Resource Manager service
- `scf_custom_endpoint` (String) Custom endpoint for the Cloud Foundry (SCF) service
- `secretsmanager_custom_endpoint` (String) Custom endpoint for the Secrets Manager service
Expand Down
1 change: 0 additions & 1 deletion docs/resources/network_area.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ resource "stackit_network_area" "example" {
resource "stackit_network_area_region" "example" {
organization_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
network_area_id = stackit_network_area.example.network_area_id
region = "eu01"
ipv4 = {
transfer_network = "192.168.1.0/24"
network_ranges = [
Expand Down
9 changes: 2 additions & 7 deletions stackit/internal/core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,8 @@ type EphemeralProviderData struct {
}

type ProviderData struct {
RoundTripper http.RoundTripper
ServiceAccountEmail string
// Deprecated: Use DefaultRegion instead
Region string
RoundTripper http.RoundTripper
ServiceAccountEmail string
DefaultRegion string
ALBCertificatesCustomEndpoint string
ALBCustomEndpoint string
Expand Down Expand Up @@ -87,10 +85,7 @@ type ProviderData struct {
func (pd *ProviderData) GetRegion() string {
if pd.DefaultRegion != "" {
return pd.DefaultRegion
} else if pd.Region != "" {
return pd.Region
}
// final fallback
return "eu01"
}

Expand Down
17 changes: 1 addition & 16 deletions stackit/internal/core/core_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,22 +70,7 @@ func TestProviderData_GetRegion(t *testing.T) {
want: "eu02",
},
{
name: "(legacy) region is set",
providerData: &ProviderData{
Region: "eu02",
},
want: "eu02",
},
{
name: "default region wins over (legacy) region",
providerData: &ProviderData{
DefaultRegion: "eu02",
Region: "eu01",
},
want: "eu02",
},
{
name: "final fallback - neither region (legacy) nor default region is set",
name: "no default region, use fallback",
providerData: &ProviderData{},
want: "eu01",
},
Expand Down
2 changes: 1 addition & 1 deletion stackit/internal/services/iaasalpha/iaas_vpc_acc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -772,8 +772,8 @@ func TestAccVPCRegionMin(t *testing.T) {
data "stackit_vpc_region" "region" {
project_id = stackit_vpc.vpc.project_id
vpc_id = stackit_vpc.vpc.vpc_id
region = "eu01"
vpc_id = stackit_vpc.vpc.vpc_id
}
`, testutil.NewConfigBuilder().Experiments(testutil.ExperimentVPC).BuildProviderConfig(), resourceVpcRegionMinConfig),
ConfigPlanChecks: resource.ConfigPlanChecks{
Expand Down
18 changes: 0 additions & 18 deletions stackit/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,11 @@ import (
"fmt"
"strings"

"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
"github.com/hashicorp/terraform-plugin-framework/datasource"
"github.com/hashicorp/terraform-plugin-framework/ephemeral"
"github.com/hashicorp/terraform-plugin-framework/path"
"github.com/hashicorp/terraform-plugin-framework/provider"
"github.com/hashicorp/terraform-plugin-framework/provider/schema"
"github.com/hashicorp/terraform-plugin-framework/resource"
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
"github.com/hashicorp/terraform-plugin-framework/types"
"github.com/hashicorp/terraform-plugin-framework/types/basetypes"
sdkauth "github.com/stackitcloud/stackit-sdk-go/core/auth"
Expand Down Expand Up @@ -179,8 +176,6 @@ type providerModel struct {
WifFederatedToken types.String `tfsdk:"service_account_federated_token"`
UseOIDC types.Bool `tfsdk:"use_oidc"`

// Deprecated: Use DefaultRegion instead
Region types.String `tfsdk:"region"`
DefaultRegion types.String `tfsdk:"default_region"`

// Custom endpoints
Expand Down Expand Up @@ -244,7 +239,6 @@ func (p *Provider) Schema(_ context.Context, _ provider.SchemaRequest, resp *pro
"use_oidc": "Enables OIDC for Authentication. This can also be sourced from the `STACKIT_USE_OIDC` Environment Variable. Defaults to `false`.",
"oidc_request_url": "The URL for the OIDC provider from which to request an ID token. For use when authenticating as a Service Account using OpenID Connect.",
"oidc_request_token": "The bearer token for the request to the OIDC provider. For use when authenticating as a Service Account using OpenID Connect.",
"region": "Region will be used as the default location for regional services. Not all services require a region, some are global",
"default_region": "Region will be used as the default location for regional services. Not all services require a region, some are global",
"alb_certificates_custom_endpoint": "Custom endpoint for the Application Load Balancer TLS Certificate service",
"alb_waf_custom_endpoint": "Custom endpoint for the Application Load Balancer Web Application Firewall service",
Expand Down Expand Up @@ -341,20 +335,9 @@ func (p *Provider) Schema(_ context.Context, _ provider.SchemaRequest, resp *pro
Optional: true,
Description: descriptions["oidc_request_url"],
},
"region": schema.StringAttribute{
Optional: true,
Description: descriptions["region"],
DeprecationMessage: "This attribute is deprecated. Use 'default_region' instead",
Validators: []validator.String{
stringvalidator.ConflictsWith(path.MatchRoot("default_region")),
},
},
"default_region": schema.StringAttribute{
Optional: true,
Description: descriptions["default_region"],
Validators: []validator.String{
stringvalidator.ConflictsWith(path.MatchRoot("region")),
},
},
"enable_beta_resources": schema.BoolAttribute{
Optional: true,
Expand Down Expand Up @@ -566,7 +549,6 @@ func (p *Provider) Configure(ctx context.Context, req provider.ConfigureRequest,
setStringField(providerConfig.TokenCustomEndpoint, func(v string) { sdkConfig.TokenCustomUrl = v })

setStringField(providerConfig.DefaultRegion, func(v string) { providerData.DefaultRegion = v })
setStringField(providerConfig.Region, func(v string) { providerData.Region = v }) // nolint:staticcheck // preliminary handling of deprecated attribute
setBoolField(providerConfig.EnableBetaResources, func(v bool) { providerData.EnableBetaResources = v })

setStringField(providerConfig.ALBCertificatesCustomEndpoint, func(v string) { providerData.ALBCertificatesCustomEndpoint = v })
Expand Down
4 changes: 2 additions & 2 deletions templates/guides/ske_log_alerts.md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This guide walks you through setting up log-based alerting in STACKIT Observabil

```hcl
provider "stackit" {
Comment thread
SerseusWasTaken marked this conversation as resolved.
region = "eu01"
default_region = "eu01"
}
provider "kubernetes" {
Expand Down Expand Up @@ -196,4 +196,4 @@ This guide walks you through setting up log-based alerting in STACKIT Observabil
}
}
}
```
```
1 change: 0 additions & 1 deletion templates/resources/network_area.md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ resource "stackit_network_area" "example" {
resource "stackit_network_area_region" "example" {
organization_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
network_area_id = stackit_network_area.example.network_area_id
region = "eu01"
ipv4 = {
transfer_network = "192.168.1.0/24"
network_ranges = [
Expand Down
Loading