diff --git a/.github/actions/acc_test/action.yaml b/.github/actions/acc_test/action.yaml index b656d5a5..e43ceeff 100644 --- a/.github/actions/acc_test/action.yaml +++ b/.github/actions/acc_test/action.yaml @@ -14,7 +14,7 @@ inputs: go-version: description: "go version to install" - default: '1.26' + default: '1.25' required: true project_id: diff --git a/.github/actions/build/action.yaml b/.github/actions/build/action.yaml index b9256143..7bea976a 100644 --- a/.github/actions/build/action.yaml +++ b/.github/actions/build/action.yaml @@ -3,7 +3,7 @@ description: "Build pipeline" inputs: go-version: description: "Go version to install" - default: '1.26' + default: '1.25' required: true java-distribution: description: "JAVA distribution to use (default: temurin)" diff --git a/.github/actions/notify/action.yaml b/.github/actions/notify/action.yaml index bc4205c6..2e72732e 100644 --- a/.github/actions/notify/action.yaml +++ b/.github/actions/notify/action.yaml @@ -142,7 +142,8 @@ runs: }} ] }') curl \ + --fail-with-body \ -X POST \ -H 'Content-Type: application/json' \ - "${{ inputs.webhook_url }}&threadKey=run${{ github.run_id }}&messageReplyOption=REPLY_MESSAGE_FALLBACK_TO_NEW_THREAD" \ + "${{ inputs.webhook_url }}" \ -d "${PAYLOAD}" diff --git a/.github/actions/setup-cache-go/action.yaml b/.github/actions/setup-cache-go/action.yaml index eb12595f..d352db76 100644 --- a/.github/actions/setup-cache-go/action.yaml +++ b/.github/actions/setup-cache-go/action.yaml @@ -10,7 +10,7 @@ inputs: go-version: description: "go version to install" - default: '1.26' + default: '1.25' required: true runs: diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index a5520ea0..dbfbc247 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -21,8 +21,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v6 - with: - fetch-tags: true - name: Check GoReleaser uses: goreleaser/goreleaser-action@v7 diff --git a/docs/data-sources/postgresflexalpha_instance.md b/docs/data-sources/postgresflexalpha_instance.md index 0652d28b..cb1d183a 100644 --- a/docs/data-sources/postgresflexalpha_instance.md +++ b/docs/data-sources/postgresflexalpha_instance.md @@ -42,16 +42,10 @@ data "stackitprivatepreview_postgresflexalpha_instance" "example" { - `flavor_id` (String) The id of the instance flavor. - `id` (String) internal ID - `is_deletable` (Boolean) Whether the instance can be deleted or not. -- `labels` (Map of String) Key-value pairs, 63 characters max, begin and end with an alphanumerical character, -may contain dashes (-), underscores (_), dots (.), and alphanumerics between. Key MUST be at least 1 character. -Max 64 labels -Regex for keys: ^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$ -Regex for values: ^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$ -The stackit- prefix is reserved and cannot be used for Keys. - `name` (String) The name of the instance. - `network` (Attributes) The access configuration of the instance (see [below for nested schema](#nestedatt--network)) - `replicas` (Number) How many replicas the instance should have. -- `retention_days` (Number) How long backups are retained. The value can only be between 32 and 90 days. +- `retention_days` (Number) How long backups are retained. The value can only be between 32 and 365 days. - `status` (String) The current status of the instance. - `storage` (Attributes) The object containing information about the storage size and class. (see [below for nested schema](#nestedatt--storage)) - `tf_original_api_id` (String) The ID of the instance. diff --git a/docs/data-sources/sqlserverflexalpha_database.md b/docs/data-sources/sqlserverflexalpha_database.md new file mode 100644 index 00000000..df66ffb7 --- /dev/null +++ b/docs/data-sources/sqlserverflexalpha_database.md @@ -0,0 +1,32 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "stackitprivatepreview_sqlserverflexalpha_database Data Source - stackitprivatepreview" +subcategory: "" +description: |- + +--- + +# stackitprivatepreview_sqlserverflexalpha_database (Data Source) + + + + + + +## Schema + +### Required + +- `database_name` (String) The name of the database. +- `instance_id` (String) The ID of the instance. +- `project_id` (String) The STACKIT project ID. +- `region` (String) The region which should be addressed + +### Read-Only + +- `collation_name` (String) The collation of the database. This database collation should match the *collation_name* of one of the collations given by the **Get database collation list** endpoint. +- `compatibility_level` (Number) CompatibilityLevel of the Database. +- `id` (String) The terraform internal identifier. +- `name` (String) The name of the database. +- `owner` (String) The owner of the database. +- `tf_original_api_id` (Number) The id of the database. diff --git a/docs/data-sources/sqlserverflexalpha_instance.md b/docs/data-sources/sqlserverflexalpha_instance.md new file mode 100644 index 00000000..b05d7b8e --- /dev/null +++ b/docs/data-sources/sqlserverflexalpha_instance.md @@ -0,0 +1,77 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "stackitprivatepreview_sqlserverflexalpha_instance Data Source - stackitprivatepreview" +subcategory: "" +description: |- + +--- + +# stackitprivatepreview_sqlserverflexalpha_instance (Data Source) + + + +## Example Usage + +```terraform +data "stackitprivatepreview_sqlserverflexalpha_instance" "example" { + project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" + instance_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" +} +``` + + +## Schema + +### Required + +- `instance_id` (String) The ID of the instance. +- `project_id` (String) The STACKIT project ID. +- `region` (String) The region which should be addressed + +### Read-Only + +- `backup_schedule` (String) The schedule for on what time and how often the database backup will be created. The schedule is written as a cron schedule. +- `edition` (String) Edition of the MSSQL server instance +- `encryption` (Attributes) this defines which key to use for storage encryption (see [below for nested schema](#nestedatt--encryption)) +- `flavor_id` (String) The id of the instance flavor. +- `is_deletable` (Boolean) Whether the instance can be deleted or not. +- `name` (String) The name of the instance. +- `network` (Attributes) The access configuration of the instance (see [below for nested schema](#nestedatt--network)) +- `replicas` (Number) How many replicas the instance should have. +- `retention_days` (Number) The days for how long the backup files should be stored before cleaned up. 30 to 365 +- `status` (String) +- `storage` (Attributes) The object containing information about the storage size and class. (see [below for nested schema](#nestedatt--storage)) +- `tf_original_api_id` (String) The ID of the instance. +- `version` (String) The sqlserver version used for the instance. + + +### Nested Schema for `encryption` + +Read-Only: + +- `kek_key_id` (String) The key identifier +- `kek_key_ring_id` (String) The keyring identifier +- `kek_key_version` (String) The key version +- `service_account` (String) + + + +### Nested Schema for `network` + +Read-Only: + +- `access_scope` (String) The network access scope of the instance + +⚠️ **Note:** This feature is in private preview. Supplying this object is only permitted for enabled accounts. If your account does not have access, the request will be rejected. +- `acl` (List of String) List of IPV4 cidr. +- `instance_address` (String) +- `router_address` (String) + + + +### Nested Schema for `storage` + +Read-Only: + +- `class` (String) The storage class for the storage. +- `size` (Number) The storage size in Gigabytes. diff --git a/docs/data-sources/sqlserverflexalpha_user.md b/docs/data-sources/sqlserverflexalpha_user.md new file mode 100644 index 00000000..63526135 --- /dev/null +++ b/docs/data-sources/sqlserverflexalpha_user.md @@ -0,0 +1,62 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "stackitprivatepreview_sqlserverflexalpha_user Data Source - stackitprivatepreview" +subcategory: "" +description: |- + +--- + +# stackitprivatepreview_sqlserverflexalpha_user (Data Source) + + + +## Example Usage + +```terraform +data "stackitprivatepreview_sqlserverflexalpha_user" "example" { + project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" + instance_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" + user_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" +} +``` + + +## Schema + +### Required + +- `instance_id` (String) The ID of the instance. +- `project_id` (String) The STACKIT project ID. +- `region` (String) The region which should be addressed + +### Optional + +- `page` (Number) Number of the page of items list to be returned. +- `size` (Number) Number of items to be returned on each page. +- `sort` (String) Sorting of the users to be returned on each page. + +### Read-Only + +- `pagination` (Attributes) (see [below for nested schema](#nestedatt--pagination)) +- `users` (Attributes List) List of all users inside an instance (see [below for nested schema](#nestedatt--users)) + + +### Nested Schema for `pagination` + +Read-Only: + +- `page` (Number) +- `size` (Number) +- `sort` (String) +- `total_pages` (Number) +- `total_rows` (Number) + + + +### Nested Schema for `users` + +Read-Only: + +- `status` (String) The current status of the user. +- `tf_original_api_id` (Number) The ID of the user. +- `username` (String) The name of the user. diff --git a/docs/data-sources/sqlserverflexbeta_flavor.md b/docs/data-sources/sqlserverflexbeta_flavor.md deleted file mode 100644 index 4d2a32f3..00000000 --- a/docs/data-sources/sqlserverflexbeta_flavor.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -# generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "stackitprivatepreview_sqlserverflexbeta_flavor Data Source - stackitprivatepreview" -subcategory: "" -description: |- - ---- - -# stackitprivatepreview_sqlserverflexbeta_flavor (Data Source) - - - -## Example Usage - -```terraform -data "stackitprivatepreview_sqlserverflexbeta_flavor" "flavor" { - project_id = var.project_id - region = var.region - cpu = 4 - ram = 16 - node_type = "Single" - storage_class = "premium-perf2-stackit" -} -``` - - -## Schema - -### Required - -- `cpu` (Number) The cpu count of the instance. -- `node_type` (String) defines the nodeType it can be either single or HA -- `project_id` (String) The project ID of the flavor. -- `ram` (Number) The memory of the instance in Gibibyte. -- `region` (String) The region of the flavor. -- `storage_class` (String) The memory of the instance in Gibibyte. - -### Read-Only - -- `description` (String) The flavor description. -- `flavor_id` (String) The id of the instance flavor. -- `id` (String) The id of the instance flavor. -- `max_gb` (Number) maximum storage which can be ordered for the flavor in Gigabyte. -- `min_gb` (Number) minimum storage which is required to order in Gigabyte. -- `storage_classes` (Attributes List) maximum storage which can be ordered for the flavor in Gigabyte. (see [below for nested schema](#nestedatt--storage_classes)) - - -### Nested Schema for `storage_classes` - -Read-Only: - -- `class` (String) -- `max_io_per_sec` (Number) -- `max_through_in_mb` (Number) diff --git a/docs/resources/postgresflexalpha_instance.md b/docs/resources/postgresflexalpha_instance.md index b82664ff..f6f10bcc 100644 --- a/docs/resources/postgresflexalpha_instance.md +++ b/docs/resources/postgresflexalpha_instance.md @@ -13,33 +13,6 @@ description: |- ## Example Usage ```terraform -# NOTE: flavor handling will change in future -# V2 compatible flavor usage (example without encryption) -resource "stackitprivatepreview_postgresflexalpha_instance" "example-instance" { - project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" - name = "example-instance" - acl = ["XXX.XXX.XXX.X/XX", "XX.XXX.XX.X/XX"] - backup_schedule = "0 0 * * *" - retention_days = 30 - flavor = { - cpu = 2 - ram = 4 - } - replicas = 1 - storage = { - performance_class = "premium-perf2-stackit" - size = 10 - } - network = { - acl = ["XXX.XXX.XXX.X/XX", "XX.XXX.XX.X/XX"] - access_scope = "PUBLIC" - } - version = 17 -} - -# future use of flavor (implemented in V3 API) -# first determine flavor and then use the flavor_id - resource "stackitprivatepreview_postgresflexalpha_instance" "example-instance" { project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" name = "example-instance" @@ -87,10 +60,11 @@ import { ### Required - `backup_schedule` (String) The schedule for when the database backup will be created. Currently, ONLY daily schedules are supported (every 24 hours). The schedule is written as a cron schedule. +- `flavor_id` (String) The id of the instance flavor. - `name` (String) The name of the instance. - `network` (Attributes) The access configuration of the instance (see [below for nested schema](#nestedatt--network)) - `replicas` (Number) How many replicas the instance should have. -- `retention_days` (Number) How long backups are retained. The value can only be between 32 and 90 days. +- `retention_days` (Number) How long backups are retained. The value can only be between 32 and 365 days. - `storage` (Attributes) The object containing information about the storage size and class. (see [below for nested schema](#nestedatt--storage)) - `version` (String) The Postgres version used for the instance. See [Versions Endpoint](/documentation/postgres-flex-service/version/v3alpha1#tag/Version) for supported version parameters. @@ -99,8 +73,6 @@ import { - `encryption` (Attributes) The configuration for instance's volume and backup storage encryption. ⚠︝ **Note:** This feature is in private preview. Supplying this object is only permitted for enabled accounts. If your account does not have access, the request will be rejected. (see [below for nested schema](#nestedatt--encryption)) -- `flavor` (Attributes, Deprecated) (see [below for nested schema](#nestedatt--flavor)) -- `flavor_id` (String) The id of the instance flavor. - `instance_id` (String) The ID of the instance. - `project_id` (String) The STACKIT project ID. - `region` (String) The region which should be addressed @@ -150,20 +122,6 @@ Required: - `service_account` (String) - -### Nested Schema for `flavor` - -Optional: - -- `cpu` (Number, Deprecated) -- `ram` (Number, Deprecated) - -Read-Only: - -- `description` (String) -- `id` (String) - - ### Nested Schema for `connection_info` diff --git a/docs/resources/sqlserverflexalpha_database.md b/docs/resources/sqlserverflexalpha_database.md new file mode 100644 index 00000000..7d8f050b --- /dev/null +++ b/docs/resources/sqlserverflexalpha_database.md @@ -0,0 +1,63 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "stackitprivatepreview_sqlserverflexalpha_database Resource - stackitprivatepreview" +subcategory: "" +description: |- + +--- + +# stackitprivatepreview_sqlserverflexalpha_database (Resource) + + + +## Example Usage + +```terraform +resource "stackitprivatepreview_sqlserverflexalpha_database" "example" { + project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" + instance_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" + collation = "" + compatibility = "160" + name = "" + owner = "" +} + +# Only use the import statement, if you want to import a existing sqlserverflex database +import { + to = stackitprivatepreview_sqlserverflexalpha_database.import-example + id = "${var.project_id},${var.region},${var.sql_instance_id},${var.sql_user_id}" +} + +import { + to = stackitprivatepreview_sqlserverflexalpha_database.import-example + identity = { + project_id = "project.id" + region = "region" + instance_id = "instance.id" + database_id = "database.id" + } +} +``` + + +## Schema + +### Required + +- `name` (String) The name of the database. +- `owner` (String) The owner of the database. + +### Optional + +- `collation` (String) The collation of the database. This database collation should match the *collation_name* of one of the collations given by the **Get database collation list** endpoint. +- `compatibility` (Number) CompatibilityLevel of the Database. +- `database_name` (String) The name of the database. +- `instance_id` (String) The ID of the instance. +- `project_id` (String) The STACKIT project ID. +- `region` (String) The region which should be addressed + +### Read-Only + +- `collation_name` (String) The collation of the database. This database collation should match the *collation_name* of one of the collations given by the **Get database collation list** endpoint. +- `compatibility_level` (Number) CompatibilityLevel of the Database. +- `id` (Number) The id of the database. diff --git a/docs/resources/sqlserverflexalpha_instance.md b/docs/resources/sqlserverflexalpha_instance.md new file mode 100644 index 00000000..95e33673 --- /dev/null +++ b/docs/resources/sqlserverflexalpha_instance.md @@ -0,0 +1,103 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "stackitprivatepreview_sqlserverflexalpha_instance Resource - stackitprivatepreview" +subcategory: "" +description: |- + +--- + +# stackitprivatepreview_sqlserverflexalpha_instance (Resource) + + + +## Example Usage + +```terraform +resource "stackitprivatepreview_sqlserverflexalpha_instance" "example" { + project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" + name = "example-instance" + acl = ["XXX.XXX.XXX.X/XX", "XX.XXX.XX.X/XX"] + backup_schedule = "00 00 * * *" + flavor = { + cpu = 4 + ram = 16 + } + storage = { + class = "class" + size = 5 + } + version = 2022 +} + +# Only use the import statement, if you want to import an existing sqlserverflex instance +import { + to = stackitprivatepreview_sqlserverflexalpha_instance.import-example + id = "${var.project_id},${var.region},${var.sql_instance_id}" +} +``` + + +## Schema + +### Required + +- `backup_schedule` (String) The schedule for on what time and how often the database backup will be created. The schedule is written as a cron schedule. +- `flavor_id` (String) The id of the instance flavor. +- `name` (String) The name of the instance. +- `network` (Attributes) the network configuration of the instance. (see [below for nested schema](#nestedatt--network)) +- `retention_days` (Number) The days for how long the backup files should be stored before cleaned up. 30 to 365 +- `storage` (Attributes) The object containing information about the storage size and class. (see [below for nested schema](#nestedatt--storage)) +- `version` (String) The sqlserver version used for the instance. + +### Optional + +- `encryption` (Attributes) this defines which key to use for storage encryption (see [below for nested schema](#nestedatt--encryption)) +- `instance_id` (String) The ID of the instance. +- `project_id` (String) The STACKIT project ID. +- `region` (String) The region which should be addressed + +### Read-Only + +- `edition` (String) Edition of the MSSQL server instance +- `id` (String) The ID of the instance. +- `is_deletable` (Boolean) Whether the instance can be deleted or not. +- `replicas` (Number) How many replicas the instance should have. +- `status` (String) + + +### Nested Schema for `network` + +Required: + +- `acl` (List of String) List of IPV4 cidr. + +Optional: + +- `access_scope` (String) The network access scope of the instance + +⚠️ **Note:** This feature is in private preview. Supplying this object is only permitted for enabled accounts. If your account does not have access, the request will be rejected. + +Read-Only: + +- `instance_address` (String) +- `router_address` (String) + + + +### Nested Schema for `storage` + +Required: + +- `class` (String) The storage class for the storage. +- `size` (Number) The storage size in Gigabytes. + + + +### Nested Schema for `encryption` + +Required: + +- `kek_key_id` (String) The key identifier +- `kek_key_ring_id` (String) The keyring identifier +- `kek_key_version` (String) The key version +- `service_account` (String) diff --git a/docs/resources/sqlserverflexalpha_user.md b/docs/resources/sqlserverflexalpha_user.md new file mode 100644 index 00000000..85d5350e --- /dev/null +++ b/docs/resources/sqlserverflexalpha_user.md @@ -0,0 +1,53 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "stackitprivatepreview_sqlserverflexalpha_user Resource - stackitprivatepreview" +subcategory: "" +description: |- + +--- + +# stackitprivatepreview_sqlserverflexalpha_user (Resource) + + + +## Example Usage + +```terraform +resource "stackitprivatepreview_sqlserverflexalpha_user" "example" { + project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" + instance_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" + username = "username" + roles = ["role"] +} + +# Only use the import statement, if you want to import an existing sqlserverflex user +import { + to = stackitprivatepreview_sqlserverflexalpha_user.import-example + id = "${var.project_id},${var.region},${var.sql_instance_id},${var.sql_user_id}" +} +``` + + +## Schema + +### Required + +- `roles` (List of String) A list containing the user roles for the instance. A list with the valid user roles can be retrieved using the List Roles endpoint. +- `username` (String) The name of the user. + +### Optional + +- `default_database` (String) The default database for a user of the instance. +- `instance_id` (String) The ID of the instance. +- `project_id` (String) The STACKIT project ID. +- `region` (String) The region which should be addressed +- `user_id` (Number) The ID of the user. + +### Read-Only + +- `host` (String) The host of the instance in which the user belongs to. +- `id` (Number) The ID of the user. +- `password` (String) The password for the user. +- `port` (Number) The port of the instance in which the user belongs to. +- `status` (String) The current status of the user. +- `uri` (String) The connection string for the user to the instance. diff --git a/docs/resources/sqlserverflexbeta_instance.md b/docs/resources/sqlserverflexbeta_instance.md index a46e76ba..20f5a9bc 100644 --- a/docs/resources/sqlserverflexbeta_instance.md +++ b/docs/resources/sqlserverflexbeta_instance.md @@ -13,31 +13,6 @@ description: |- ## Example Usage ```terraform -# NOTE: flavor handling will change in future -# V2 compatible flavor usage -resource "stackitprivatepreview_sqlserverflexbeta_instance" "instance" { - project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" - name = "example-instance" - backup_schedule = "0 3 * * *" - retention_days = 31 - flavor = { - cpu = 2 - ram = 4 - } - storage = { - class = "premium-perf2-stackit" - size = 50 - } - version = 2022 - network = { - acl = ["XXX.XXX.XXX.X/XX", "XX.XXX.XX.X/XX"] - access_scope = "SNA" - } -} - -# future use of flavor (implemented in V3 API) -# first determine flavor and then use the flavor_id - # without encryption and SNA resource "stackitprivatepreview_sqlserverflexbeta_instance" "instance" { project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" @@ -122,6 +97,7 @@ import { ### Required - `backup_schedule` (String) The schedule for on what time and how often the database backup will be created. The schedule is written as a cron schedule. +- `flavor_id` (String) The id of the instance flavor. - `name` (String) The name of the instance. - `network` (Attributes) the network configuration of the instance. (see [below for nested schema](#nestedatt--network)) - `retention_days` (Number) The days for how long the backup files should be stored before cleaned up. 30 to 365 @@ -131,8 +107,6 @@ import { ### Optional - `encryption` (Attributes) this defines which key to use for storage encryption (see [below for nested schema](#nestedatt--encryption)) -- `flavor` (Attributes, Deprecated) (see [below for nested schema](#nestedatt--flavor)) -- `flavor_id` (String) The id of the instance flavor. - `instance_id` (String) The ID of the instance. - `project_id` (String) The STACKIT project ID. - `region` (String) The region which should be addressed @@ -182,17 +156,3 @@ Required: - `kek_key_ring_id` (String) The keyring identifier - `kek_key_version` (String) The key version - `service_account` (String) - - - -### Nested Schema for `flavor` - -Optional: - -- `cpu` (Number, Deprecated) -- `ram` (Number, Deprecated) - -Read-Only: - -- `description` (String) -- `id` (String) diff --git a/examples/resources/stackitprivatepreview_postgresflexalpha_instance/resource.tf b/examples/resources/stackitprivatepreview_postgresflexalpha_instance/resource.tf index 7250b66b..b503f0ce 100644 --- a/examples/resources/stackitprivatepreview_postgresflexalpha_instance/resource.tf +++ b/examples/resources/stackitprivatepreview_postgresflexalpha_instance/resource.tf @@ -1,30 +1,3 @@ -# NOTE: flavor handling will change in future -# V2 compatible flavor usage (example without encryption) -resource "stackitprivatepreview_postgresflexalpha_instance" "example-instance" { - project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" - name = "example-instance" - acl = ["XXX.XXX.XXX.X/XX", "XX.XXX.XX.X/XX"] - backup_schedule = "0 0 * * *" - retention_days = 30 - flavor = { - cpu = 2 - ram = 4 - } - replicas = 1 - storage = { - performance_class = "premium-perf2-stackit" - size = 10 - } - network = { - acl = ["XXX.XXX.XXX.X/XX", "XX.XXX.XX.X/XX"] - access_scope = "PUBLIC" - } - version = 17 -} - -# future use of flavor (implemented in V3 API) -# first determine flavor and then use the flavor_id - resource "stackitprivatepreview_postgresflexalpha_instance" "example-instance" { project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" name = "example-instance" diff --git a/examples/resources/stackitprivatepreview_sqlserverflexbeta_instance/resource.tf b/examples/resources/stackitprivatepreview_sqlserverflexbeta_instance/resource.tf index 565ae019..06e88f64 100644 --- a/examples/resources/stackitprivatepreview_sqlserverflexbeta_instance/resource.tf +++ b/examples/resources/stackitprivatepreview_sqlserverflexbeta_instance/resource.tf @@ -1,28 +1,3 @@ -# NOTE: flavor handling will change in future -# V2 compatible flavor usage -resource "stackitprivatepreview_sqlserverflexbeta_instance" "instance" { - project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" - name = "example-instance" - backup_schedule = "0 3 * * *" - retention_days = 31 - flavor = { - cpu = 2 - ram = 4 - } - storage = { - class = "premium-perf2-stackit" - size = 50 - } - version = 2022 - network = { - acl = ["XXX.XXX.XXX.X/XX", "XX.XXX.XX.X/XX"] - access_scope = "SNA" - } -} - -# future use of flavor (implemented in V3 API) -# first determine flavor and then use the flavor_id - # without encryption and SNA resource "stackitprivatepreview_sqlserverflexbeta_instance" "instance" { project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" diff --git a/generator/cmd/docCmd.go b/generator/cmd/docCmd.go index cf36610b..77b1dc23 100644 --- a/generator/cmd/docCmd.go +++ b/generator/cmd/docCmd.go @@ -172,12 +172,12 @@ func workDocs() error { case "data-sources": dataSources[matches[0][1]] = append(dataSources[matches[0][1]], ResItem{ ItemName: matches[0][2], - ItemLink: fmt.Sprintf("/docs/docs/%s/%s", entry.Name(), matches[0][0]), + ItemLink: fmt.Sprintf("docs/%s/%s", entry.Name(), matches[0][0]), }) case "resources": resources[matches[0][1]] = append(resources[matches[0][1]], ResItem{ ItemName: matches[0][2], - ItemLink: fmt.Sprintf("/docs/docs/%s/%s", entry.Name(), matches[0][0]), + ItemLink: fmt.Sprintf("docs/%s/%s", entry.Name(), matches[0][0]), }) default: return fmt.Errorf("this should never have happened") diff --git a/go.mod b/go.mod index 9954c594..b9cf8d3f 100644 --- a/go.mod +++ b/go.mod @@ -1,25 +1,25 @@ module tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview -go 1.26.2 +go 1.25.6 require ( - github.com/SladkyCitron/slogcolor v1.9.0 + github.com/SladkyCitron/slogcolor v1.8.0 github.com/google/go-cmp v0.7.0 github.com/google/uuid v1.6.0 github.com/hashicorp/terraform-plugin-framework v1.19.0 github.com/hashicorp/terraform-plugin-framework-validators v0.19.0 github.com/hashicorp/terraform-plugin-go v0.31.0 github.com/hashicorp/terraform-plugin-log v0.10.0 - github.com/hashicorp/terraform-plugin-testing v1.16.0 + github.com/hashicorp/terraform-plugin-testing v1.15.0 github.com/iancoleman/strcase v0.3.0 github.com/ivanpirog/coloredcobra v1.0.1 github.com/jarcoal/httpmock v1.4.1 github.com/joho/godotenv v1.5.1 github.com/ldez/go-git-cmd-wrapper/v2 v2.9.1 github.com/spf13/cobra v1.10.2 - github.com/stackitcloud/stackit-sdk-go/core v0.26.0 - github.com/stackitcloud/stackit-sdk-go/services/postgresflex v1.8.0 - github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex v1.10.0 + github.com/stackitcloud/stackit-sdk-go/core v0.25.0 + github.com/stackitcloud/stackit-sdk-go/services/postgresflex v1.7.1 + github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex v1.9.0 github.com/teambition/rrule-go v1.8.2 gopkg.in/yaml.v3 v3.0.1 ) @@ -28,67 +28,47 @@ require github.com/hashicorp/go-retryablehttp v0.7.8 // indirect require ( dario.cat/mergo v1.0.1 // indirect - github.com/BurntSushi/toml v1.2.1 // indirect - github.com/Kunde21/markdownfmt/v3 v3.1.0 // indirect - github.com/Masterminds/goutils v1.1.1 // indirect - github.com/Masterminds/semver/v3 v3.2.0 // indirect - github.com/Masterminds/sprig/v3 v3.2.3 // indirect github.com/ProtonMail/go-crypto v1.4.1 // indirect github.com/agext/levenshtein v1.2.3 // indirect github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect - github.com/armon/go-radix v1.0.0 // indirect - github.com/bgentry/speakeasy v0.1.0 // indirect - github.com/bmatcuk/doublestar/v4 v4.10.0 // indirect github.com/cloudflare/circl v1.6.3 // indirect github.com/fatih/color v1.19.0 // indirect github.com/golang-jwt/jwt/v5 v5.3.1 // indirect github.com/golang/protobuf v1.5.4 // indirect - github.com/hashicorp/cli v1.1.7 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-checkpoint v0.5.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-cty v1.5.0 // indirect github.com/hashicorp/go-hclog v1.6.3 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect - github.com/hashicorp/go-plugin v1.8.0 // indirect + github.com/hashicorp/go-plugin v1.7.0 // indirect github.com/hashicorp/go-uuid v1.0.3 // indirect github.com/hashicorp/go-version v1.9.0 // indirect - github.com/hashicorp/hc-install v0.9.5 // indirect + github.com/hashicorp/hc-install v0.9.3 // indirect github.com/hashicorp/hcl/v2 v2.24.0 // indirect github.com/hashicorp/logutils v1.0.0 // indirect - github.com/hashicorp/terraform-exec v0.25.2 // indirect - github.com/hashicorp/terraform-json v0.27.3-0.20260213134036-298b8f6b673a // indirect - github.com/hashicorp/terraform-plugin-docs v0.25.0 // indirect - github.com/hashicorp/terraform-plugin-sdk/v2 v2.40.1 // indirect + github.com/hashicorp/terraform-exec v0.25.0 // indirect + github.com/hashicorp/terraform-json v0.27.2 // indirect + github.com/hashicorp/terraform-plugin-sdk/v2 v2.40.0 // indirect github.com/hashicorp/terraform-registry-address v0.4.0 // indirect github.com/hashicorp/terraform-svchost v0.2.1 // indirect github.com/hashicorp/yamux v0.1.2 // indirect - github.com/huandu/xstrings v1.3.3 // indirect - github.com/imdario/mergo v0.3.15 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/mattn/go-colorable v0.1.14 // indirect - github.com/mattn/go-isatty v0.0.22 // indirect - github.com/mattn/go-runewidth v0.0.9 // indirect + github.com/mattn/go-isatty v0.0.21 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/go-wordwrap v1.0.1 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/oklog/run v1.2.0 // indirect - github.com/posener/complete v1.2.3 // indirect - github.com/shopspring/decimal v1.3.1 // indirect - github.com/spf13/cast v1.5.0 // indirect github.com/spf13/pflag v1.0.10 // indirect github.com/stretchr/testify v1.11.1 // indirect github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect - github.com/yuin/goldmark v1.7.7 // indirect - github.com/yuin/goldmark-meta v1.1.0 // indirect github.com/zclconf/go-cty v1.18.1 // indirect - go.abhg.dev/goldmark/frontmatter v0.2.0 // indirect golang.org/x/crypto v0.50.0 // indirect - golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df // indirect golang.org/x/mod v0.35.0 // indirect golang.org/x/net v0.53.0 // indirect golang.org/x/sync v0.20.0 // indirect @@ -96,8 +76,7 @@ require ( golang.org/x/text v0.36.0 // indirect golang.org/x/tools v0.44.0 // indirect google.golang.org/appengine v1.6.8 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20260504160031-60b97b32f348 // indirect - google.golang.org/grpc v1.81.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20260414002931-afd174a4e478 // indirect + google.golang.org/grpc v1.80.0 // indirect google.golang.org/protobuf v1.36.11 // indirect - gopkg.in/yaml.v2 v2.4.0 // indirect ) diff --git a/go.sum b/go.sum index eb49c8e4..a4709994 100644 --- a/go.sum +++ b/go.sum @@ -1,32 +1,16 @@ dario.cat/mergo v1.0.1 h1:Ra4+bf83h2ztPIQYNP99R6m+Y7KfnARDfID+a+vLl4s= dario.cat/mergo v1.0.1/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= -github.com/BurntSushi/toml v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak= -github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= -github.com/Kunde21/markdownfmt/v3 v3.1.0 h1:KiZu9LKs+wFFBQKhrZJrFZwtLnCCWJahL+S+E/3VnM0= -github.com/Kunde21/markdownfmt/v3 v3.1.0/go.mod h1:tPXN1RTyOzJwhfHoon9wUr4HGYmWgVxSQN6VBJDkrVc= -github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= -github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= -github.com/Masterminds/semver/v3 v3.2.0 h1:3MEsd0SM6jqZojhjLWWeBY+Kcjy9i6MQAeY7YgDP83g= -github.com/Masterminds/semver/v3 v3.2.0/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= -github.com/Masterminds/sprig/v3 v3.2.3 h1:eL2fZNezLomi0uOLqjQoN6BfsDD+fyLtgbJMAj9n6YA= -github.com/Masterminds/sprig/v3 v3.2.3/go.mod h1:rXcFaZ2zZbLRJv/xSysmlgIM1u11eBaRMhvYXJNkGuM= github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= github.com/ProtonMail/go-crypto v1.4.1 h1:9RfcZHqEQUvP8RzecWEUafnZVtEvrBVL9BiF67IQOfM= github.com/ProtonMail/go-crypto v1.4.1/go.mod h1:e1OaTyu5SYVrO9gKOEhTc+5UcXtTUa+P3uLudwcgPqo= -github.com/SladkyCitron/slogcolor v1.9.0 h1:fr4LeG+T6pZ1RYNNOP925jaBYrTdpA6BLzGy29yd4vI= -github.com/SladkyCitron/slogcolor v1.9.0/go.mod h1:ft8LEVIl4isUkebakhv+ngNXJjWBumnwhXfxTLApf3M= +github.com/SladkyCitron/slogcolor v1.8.0 h1:ln4mUPfVhs7a/vZfjnKkz5YZ71Bg/KFWneS2hfFq6FM= +github.com/SladkyCitron/slogcolor v1.8.0/go.mod h1:ft8LEVIl4isUkebakhv+ngNXJjWBumnwhXfxTLApf3M= github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo= github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec= github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY= github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= -github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI= -github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY= -github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bmatcuk/doublestar/v4 v4.10.0 h1:zU9WiOla1YA122oLM6i4EXvGW62DvKZVxIe6TYWexEs= -github.com/bmatcuk/doublestar/v4 v4.10.0/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= github.com/bufbuild/protocompile v0.14.1 h1:iA73zAf/fyljNjQKwYzUHD6AD4R8KMasmwa/FBatYVw= github.com/bufbuild/protocompile v0.14.1/go.mod h1:ppVdAIhbr2H8asPk6k4pY7t9zB1OU5DoEw9xY/FUi1c= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= @@ -48,10 +32,10 @@ github.com/fatih/color v1.19.0 h1:Zp3PiM21/9Ld6FzSKyL5c/BULoe/ONr9KlbYVOfG8+w= github.com/fatih/color v1.19.0/go.mod h1:zNk67I0ZUT1bEGsSGyCZYZNrHuTkJJB+r6Q9VuMi0LE= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic= -github.com/go-git/go-billy/v5 v5.8.0 h1:I8hjc3LbBlXTtVuFNJuwYuMiHvQJDq1AT6u4DwDzZG0= -github.com/go-git/go-billy/v5 v5.8.0/go.mod h1:RpvI/rw4Vr5QA+Z60c6d6LXH0rYJo0uD5SqfmrrheCY= -github.com/go-git/go-git/v5 v5.18.0 h1:O831KI+0PR51hM2kep6T8k+w0/LIAD490gvqMCvL5hM= -github.com/go-git/go-git/v5 v5.18.0/go.mod h1:pW/VmeqkanRFqR6AljLcs7EA7FbZaN5MQqO7oZADXpo= +github.com/go-git/go-billy/v5 v5.6.2 h1:6Q86EsPXMa7c3YZ3aLAQsMA0VlWmy43r6FHqa/UNbRM= +github.com/go-git/go-billy/v5 v5.6.2/go.mod h1:rcFC2rAsp/erv7CMz9GczHcuD0D32fWzH+MJAU+jaUU= +github.com/go-git/go-git/v5 v5.16.5 h1:mdkuqblwr57kVfXri5TTH+nMFLNUxIj9Z7F5ykFbw5s= +github.com/go-git/go-git/v5 v5.16.5/go.mod h1:QOMLpNf1qxuSY4StA/ArOdfFR2TrKEjJiye2kel2m+M= github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= @@ -71,11 +55,8 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/hashicorp/cli v1.1.7 h1:/fZJ+hNdwfTSfsxMBa9WWMlfjUZbX8/LnUxgAd7lCVU= -github.com/hashicorp/cli v1.1.7/go.mod h1:e6Mfpga9OCT1vqzFuoGZiiF/KaG9CbUfO5s3ghU3YgU= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= @@ -88,11 +69,10 @@ github.com/hashicorp/go-cty v1.5.0 h1:EkQ/v+dDNUqnuVpmS5fPqyY71NXVgT5gf32+57xY8g github.com/hashicorp/go-cty v1.5.0/go.mod h1:lFUCG5kd8exDobgSfyj4ONE/dc822kiYMguVKdHGMLM= github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k= github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= -github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= -github.com/hashicorp/go-plugin v1.8.0 h1:ie8S6RRY8RvB2usYZv+AAZ/wBvx2AU5p5QeP5j/FORs= -github.com/hashicorp/go-plugin v1.8.0/go.mod h1:BExt6KEaIYx804z8k4gRzRLEvxKVb+kn0NMcihqOqb8= +github.com/hashicorp/go-plugin v1.7.0 h1:YghfQH/0QmPNc/AZMTFE3ac8fipZyZECHdDPshfk+mA= +github.com/hashicorp/go-plugin v1.7.0/go.mod h1:BExt6KEaIYx804z8k4gRzRLEvxKVb+kn0NMcihqOqb8= github.com/hashicorp/go-retryablehttp v0.7.8 h1:ylXZWnqa7Lhqpk0L1P1LzDtGcCR0rPVUrx/c8Unxc48= github.com/hashicorp/go-retryablehttp v0.7.8/go.mod h1:rjiScheydd+CxvumBsIrFKlx3iS0jrZ7LvzFGFmuKbw= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= @@ -100,20 +80,16 @@ github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/C github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-version v1.9.0 h1:CeOIz6k+LoN3qX9Z0tyQrPtiB1DFYRPfCIBtaXPSCnA= github.com/hashicorp/go-version v1.9.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/hc-install v0.9.5 h1:XHCjcMn2563ysuaQ9v9ec2FNc7c2PJOIEEGobAFeIx4= -github.com/hashicorp/hc-install v0.9.5/go.mod h1:ihEW4LshrNkxq2bU/MpVbKyn+yt1is2hYqUTHDGhG84= +github.com/hashicorp/hc-install v0.9.3 h1:1H4dgmgzxEVwT6E/d/vIL5ORGVKz9twRwDw+qA5Hyho= +github.com/hashicorp/hc-install v0.9.3/go.mod h1:FQlQ5I3I/X409N/J1U4pPeQQz1R3BoV0IysB7aiaQE0= github.com/hashicorp/hcl/v2 v2.24.0 h1:2QJdZ454DSsYGoaE6QheQZjtKZSUs9Nh2izTWiwQxvE= github.com/hashicorp/hcl/v2 v2.24.0/go.mod h1:oGoO1FIQYfn/AgyOhlg9qLC6/nOJPX3qGbkZpYAcqfM= github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= -github.com/hashicorp/terraform-exec v0.25.2 h1:fFLAVEtAjKdGfawGUXDnKooCnqJi+TuohT3W99AGbhk= -github.com/hashicorp/terraform-exec v0.25.2/go.mod h1:uaQV2oqVLqM4cixJryk6qIWS1qji3GtuwPG5pjGXYfc= +github.com/hashicorp/terraform-exec v0.25.0 h1:Bkt6m3VkJqYh+laFMrWIpy9KHYFITpOyzRMNI35rNaY= +github.com/hashicorp/terraform-exec v0.25.0/go.mod h1:dl9IwsCfklDU6I4wq9/StFDp7dNbH/h5AnfS1RmiUl8= github.com/hashicorp/terraform-json v0.27.2 h1:BwGuzM6iUPqf9JYM/Z4AF1OJ5VVJEEzoKST/tRDBJKU= github.com/hashicorp/terraform-json v0.27.2/go.mod h1:GzPLJ1PLdUG5xL6xn1OXWIjteQRT2CNT9o/6A9mi9hE= -github.com/hashicorp/terraform-json v0.27.3-0.20260213134036-298b8f6b673a h1:T7AMR21kjrbeEpN+KhGlyd31XXHsSZF5zg+ivfeYte4= -github.com/hashicorp/terraform-json v0.27.3-0.20260213134036-298b8f6b673a/go.mod h1:yjb5C2W07l8lmAzdyVgOLji0/D2IoHkR3rusBzUO4O0= -github.com/hashicorp/terraform-plugin-docs v0.25.0 h1:qHs1V257NxVe8tv6HS4UQfNqjaPP5eUlLeDf7jYk85U= -github.com/hashicorp/terraform-plugin-docs v0.25.0/go.mod h1:MQggCmY8zgP7R7E/cC0b0cmTvA9hSj3ZKyrrsDjRbLo= github.com/hashicorp/terraform-plugin-framework v1.19.0 h1:q0bwyhxAOR3vfdgbk9iplv3MlTv/dhBHTXjQOtQDoBA= github.com/hashicorp/terraform-plugin-framework v1.19.0/go.mod h1:YRXOBu0jvs7xp4AThBbX4mAzYaMJ1JgtFH//oGKxwLc= github.com/hashicorp/terraform-plugin-framework-validators v0.19.0 h1:Zz3iGgzxe/1XBkooZCewS0nJAaCFPFPHdNJd8FgE4Ow= @@ -122,23 +98,18 @@ github.com/hashicorp/terraform-plugin-go v0.31.0 h1:0Fz2r9DQ+kNNl6bx8HRxFd1TfMKU github.com/hashicorp/terraform-plugin-go v0.31.0/go.mod h1:A88bDhd/cW7FnwqxQRz3slT+QY6yzbHKc6AOTtmdeS8= github.com/hashicorp/terraform-plugin-log v0.10.0 h1:eu2kW6/QBVdN4P3Ju2WiB2W3ObjkAsyfBsL3Wh1fj3g= github.com/hashicorp/terraform-plugin-log v0.10.0/go.mod h1:/9RR5Cv2aAbrqcTSdNmY1NRHP4E3ekrXRGjqORpXyB0= -github.com/hashicorp/terraform-plugin-sdk/v2 v2.40.1 h1:2yPUd7esMOpuTaG3y1iEla1iw+tla+3ZEkkBnmOAre4= -github.com/hashicorp/terraform-plugin-sdk/v2 v2.40.1/go.mod h1:sq8qsxh+PwdvTQFcd17kfCoBgQo46ADNMvCpKE7t/gY= -github.com/hashicorp/terraform-plugin-testing v1.16.0 h1:GB97nGnJ1hESpDrCjqZig38RodSF0gdRzxlDupLXP38= -github.com/hashicorp/terraform-plugin-testing v1.16.0/go.mod h1:eQPYAy9xFMV7xtIFX8Y+wJGtUB++HBl329zCF6PBMZk= +github.com/hashicorp/terraform-plugin-sdk/v2 v2.40.0 h1:MKS/2URqeJRwJdbOfcbdsZCq/IRrNkqJNN0GtVIsuGs= +github.com/hashicorp/terraform-plugin-sdk/v2 v2.40.0/go.mod h1:PuG4P97Ju3QXW6c6vRkRadWJbvnEu2Xh+oOuqcYOqX4= +github.com/hashicorp/terraform-plugin-testing v1.15.0 h1:/fimKyl0YgD7aAtJkuuAZjwBASXhCIwWqMbDLnKLMe4= +github.com/hashicorp/terraform-plugin-testing v1.15.0/go.mod h1:bGXMw7bE95EiZhSBV3rM2W8TiffaPTDuLS+HFI/lIYs= github.com/hashicorp/terraform-registry-address v0.4.0 h1:S1yCGomj30Sao4l5BMPjTGZmCNzuv7/GDTDX99E9gTk= github.com/hashicorp/terraform-registry-address v0.4.0/go.mod h1:LRS1Ay0+mAiRkUyltGT+UHWkIqTFvigGn/LbMshfflE= github.com/hashicorp/terraform-svchost v0.2.1 h1:ubvrTFw3Q7CsoEaX7V06PtCTKG3wu7GyyobAoN4eF3Q= github.com/hashicorp/terraform-svchost v0.2.1/go.mod h1:zDMheBLvNzu7Q6o9TBvPqiZToJcSuCLXjAXxBslSky4= github.com/hashicorp/yamux v0.1.2 h1:XtB8kyFOyHXYVFnwT5C3+Bdo8gArse7j2AQ0DA0Uey8= github.com/hashicorp/yamux v0.1.2/go.mod h1:C+zze2n6e/7wshOZep2A70/aQU6QBRWJO/G6FT1wIns= -github.com/huandu/xstrings v1.3.3 h1:/Gcsuc1x8JVbJ9/rlye4xZnVAbEkGauT8lbebqcQws4= -github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI= github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= -github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= -github.com/imdario/mergo v0.3.15 h1:M8XP7IuFNsqUx6VPK2P9OSmsYsI/YFaGil0uD21V3dM= -github.com/imdario/mergo v0.3.15/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= @@ -158,8 +129,9 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/ldez/go-git-cmd-wrapper/v2 v2.9.1 h1:QJRB9Gs5i/h6TVJI6yl09Qm6rNooznRiKwIw+VIxd90= github.com/ldez/go-git-cmd-wrapper/v2 v2.9.1/go.mod h1:0eUeas7XtKDPKQbB0KijfaMPbuQ/cIprtoTRiwaUoFg= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= @@ -168,13 +140,10 @@ github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHP github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= -github.com/mattn/go-isatty v0.0.22 h1:j8l17JJ9i6VGPUFUYoTUKPSgKe/83EYU2zBC7YNKMw4= -github.com/mattn/go-isatty v0.0.22/go.mod h1:ZXfXG4SQHsB/w3ZeOYbR0PrPwLy+n6xiMrJlRFqopa4= -github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= -github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= +github.com/mattn/go-isatty v0.0.21 h1:xYae+lCNBP7QuW4PUnNG61ffM4hVIfm+zUzDuSzYLGs= +github.com/mattn/go-isatty v0.0.21/go.mod h1:ZXfXG4SQHsB/w3ZeOYbR0PrPwLy+n6xiMrJlRFqopa4= github.com/maxatome/go-testdeep v1.14.0 h1:rRlLv1+kI8eOI3OaBXZwb3O7xY3exRzdW5QyX48g9wI= github.com/maxatome/go-testdeep v1.14.0/go.mod h1:lPZc/HAcJMP92l7yI6TRz1aZN5URwUBUAfUNvrclaNM= -github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU= @@ -183,7 +152,6 @@ github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQ github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/oklog/run v1.2.0 h1:O8x3yXwah4A73hJdlrwo/2X6J62gE5qTMusH0dvz60E= @@ -193,21 +161,13 @@ github.com/pjbgf/sha1cd v0.3.2/go.mod h1:zQWigSxVmsHEZow5qaLtPYxpcKMMQpa09ixqBxu github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/posener/complete v1.2.3 h1:NP0eAhjcjImqslEwo/1hq7gpajME0fTLTezBKDqfXqo= -github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= -github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= -github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= -github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/skeema/knownhosts v1.3.1 h1:X2osQ+RAjK76shCbvhHHHVl3ZlgDm8apHEHFqRjnBY8= github.com/skeema/knownhosts v1.3.1/go.mod h1:r7KTdC8l4uxWRyK2TpQZ/1o5HaSzh06ePQNxPwTcfiY= -github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= -github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g= github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU= github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4= @@ -215,16 +175,13 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/stackitcloud/stackit-sdk-go/core v0.26.0 h1:jQEb9gkehfp6VCP6TcYk7BI10cz4l0KM2L6hqYBH2QA= -github.com/stackitcloud/stackit-sdk-go/core v0.26.0/go.mod h1:WU1hhxnjXw2EV7CYa1nlEvNpMiRY6CvmIOaHuL3pOaA= -github.com/stackitcloud/stackit-sdk-go/services/postgresflex v1.8.0 h1:oWTviJKdlUxaaARJghTjOqBbarIK+7+nH3Kc3Wxn4rQ= -github.com/stackitcloud/stackit-sdk-go/services/postgresflex v1.8.0/go.mod h1:yzlakB+f8ur4yAHR6lyCABO+HcEtZG3G2Faj6m5/uW8= -github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex v1.10.0 h1:angvO3z0TGqZtdwTDsG/tgTw9hxB76A6leUsiUXQtME= -github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex v1.10.0/go.mod h1:AiUoMAqQcOlMgDtkVJlqI7P/VGD5xjN3dYjERGnwN/M= +github.com/stackitcloud/stackit-sdk-go/core v0.25.0 h1:ra3VEk684MNoq741g+xbZrKjZzhyztq5liUAwwew4DY= +github.com/stackitcloud/stackit-sdk-go/core v0.25.0/go.mod h1:WU1hhxnjXw2EV7CYa1nlEvNpMiRY6CvmIOaHuL3pOaA= +github.com/stackitcloud/stackit-sdk-go/services/postgresflex v1.7.1 h1:BWa9O8iRU1l8izGIoH9/+GEF20uu8WDWSesqjdJ3+lg= +github.com/stackitcloud/stackit-sdk-go/services/postgresflex v1.7.1/go.mod h1:xBWn0vpyyh+IA4muynufqIKmc1fJPPp+uY/iXwa5epE= +github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex v1.9.0 h1:dv+8GYcI2G0BQvMN5Qb4kaCREaj9n2lRzj9sb29NEZg= +github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex v1.9.0/go.mod h1:HTpVer71ZfpKozpzWVv7EbCPB5ko8vgw4VmFE38lB9I= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= @@ -240,36 +197,27 @@ github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -github.com/yuin/goldmark v1.7.7 h1:5m9rrB1sW3JUMToKFQfb+FGt1U7r57IHu5GrYrG2nqU= -github.com/yuin/goldmark v1.7.7/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E= -github.com/yuin/goldmark-meta v1.1.0 h1:pWw+JLHGZe8Rk0EGsMVssiNb/AaPMHfSRszZeUeiOUc= -github.com/yuin/goldmark-meta v1.1.0/go.mod h1:U4spWENafuA7Zyg+Lj5RqK/MF+ovMYtBvXi1lBb2VP0= github.com/zclconf/go-cty v1.18.1 h1:yEGE8M4iIZlyKQURZNb2SnEyZlZHUcBCnx6KF81KuwM= github.com/zclconf/go-cty v1.18.1/go.mod h1:qpnV6EDNgC1sns/AleL1fvatHw72j+S+nS+MJ+T2CSg= github.com/zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940 h1:4r45xpDWB6ZMSMNJFMOjqrGHynW3DIBuR2H9j0ug+Mo= github.com/zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940/go.mod h1:CmBdvvj3nqzfzJ6nTCIwDTPZ56aVGvDrmztiO5g3qrM= -go.abhg.dev/goldmark/frontmatter v0.2.0 h1:P8kPG0YkL12+aYk2yU3xHv4tcXzeVnN+gU0tJ5JnxRw= -go.abhg.dev/goldmark/frontmatter v0.2.0/go.mod h1:XqrEkZuM57djk7zrlRUB02x8I5J0px76YjkOzhB4YlU= go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= -go.opentelemetry.io/otel v1.43.0 h1:mYIM03dnh5zfN7HautFE4ieIig9amkNANT+xcVxAj9I= -go.opentelemetry.io/otel v1.43.0/go.mod h1:JuG+u74mvjvcm8vj8pI5XiHy1zDeoCS2LB1spIq7Ay0= -go.opentelemetry.io/otel/metric v1.43.0 h1:d7638QeInOnuwOONPp4JAOGfbCEpYb+K6DVWvdxGzgM= -go.opentelemetry.io/otel/metric v1.43.0/go.mod h1:RDnPtIxvqlgO8GRW18W6Z/4P462ldprJtfxHxyKd2PY= -go.opentelemetry.io/otel/sdk v1.43.0 h1:pi5mE86i5rTeLXqoF/hhiBtUNcrAGHLKQdhg4h4V9Dg= -go.opentelemetry.io/otel/sdk v1.43.0/go.mod h1:P+IkVU3iWukmiit/Yf9AWvpyRDlUeBaRg6Y+C58QHzg= -go.opentelemetry.io/otel/sdk/metric v1.43.0 h1:S88dyqXjJkuBNLeMcVPRFXpRw2fuwdvfCGLEo89fDkw= -go.opentelemetry.io/otel/sdk/metric v1.43.0/go.mod h1:C/RJtwSEJ5hzTiUz5pXF1kILHStzb9zFlIEe85bhj6A= -go.opentelemetry.io/otel/trace v1.43.0 h1:BkNrHpup+4k4w+ZZ86CZoHHEkohws8AY+WTX09nk+3A= -go.opentelemetry.io/otel/trace v1.43.0/go.mod h1:/QJhyVBUUswCphDVxq+8mld+AvhXZLhe+8WVFxiFff0= +go.opentelemetry.io/otel v1.39.0 h1:8yPrr/S0ND9QEfTfdP9V+SiwT4E0G7Y5MO7p85nis48= +go.opentelemetry.io/otel v1.39.0/go.mod h1:kLlFTywNWrFyEdH0oj2xK0bFYZtHRYUdv1NklR/tgc8= +go.opentelemetry.io/otel/metric v1.39.0 h1:d1UzonvEZriVfpNKEVmHXbdf909uGTOQjA0HF0Ls5Q0= +go.opentelemetry.io/otel/metric v1.39.0/go.mod h1:jrZSWL33sD7bBxg1xjrqyDjnuzTUB0x1nBERXd7Ftcs= +go.opentelemetry.io/otel/sdk v1.39.0 h1:nMLYcjVsvdui1B/4FRkwjzoRVsMK8uL/cj0OyhKzt18= +go.opentelemetry.io/otel/sdk v1.39.0/go.mod h1:vDojkC4/jsTJsE+kh+LXYQlbL8CgrEcwmt1ENZszdJE= +go.opentelemetry.io/otel/sdk/metric v1.39.0 h1:cXMVVFVgsIf2YL6QkRF4Urbr/aMInf+2WKg+sEJTtB8= +go.opentelemetry.io/otel/sdk/metric v1.39.0/go.mod h1:xq9HEVH7qeX69/JnwEfp6fVq5wosJsY1mt4lLfYdVew= +go.opentelemetry.io/otel/trace v1.39.0 h1:2d2vfpEDmCJ5zVYz7ijaJdOF59xLomrvj7bjt6/qCJI= +go.opentelemetry.io/otel/trace v1.39.0/go.mod h1:88w4/PnZSazkGzz/w84VHpQafiU4EtqqlVdxWy+rNOA= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.50.0 h1:zO47/JPrL6vsNkINmLoo/PH1gcxpls50DNogFvB5ZGI= golang.org/x/crypto v0.50.0/go.mod h1:3muZ7vA7PBCE6xgPX7nkzzjiUq87kRItoJQM1Yo8S+Q= -golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df h1:UA2aFVmmsIlefxMk29Dp2juaUSth8Pyn3Tq5Y5mJGME= -golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.35.0 h1:Ww1D637e6Pg+Zb2KrWfHQUnH2dQRLBQyAtpr/haaJeM= golang.org/x/mod v0.35.0/go.mod h1:+GwiRhIInF8wPm+4AoT6L0FA1QWAad3OMdTRx4tFYlU= @@ -277,7 +225,6 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.53.0 h1:d+qAbo5L0orcWAr0a9JweQpjXF19LMXJE8Ey7hwOdUA= golang.org/x/net v0.53.0/go.mod h1:JvMuJH7rrdiCfbeHoo3fCQU24Lf5JJwT9W3sJFulfgs= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -295,19 +242,16 @@ golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.43.0 h1:Rlag2XtaFTxp19wS8MXlJwTvoh8ArU6ezoyFsMyCTNI= golang.org/x/sys v0.43.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.42.0 h1:UiKe+zDFmJobeJ5ggPwOshJIVt6/Ft0rcfrXZDLWAWY= golang.org/x/term v0.42.0/go.mod h1:Dq/D+snpsbazcBG5+F9Q1n2rXV8Ma+71xEjTRufARgY= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= -golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.36.0 h1:JfKh3XmcRPqZPKevfXVpI1wXPTqbkE5f7JA92a55Yxg= golang.org/x/text v0.36.0/go.mod h1:NIdBknypM8iqVmPiuco0Dh6P5Jcdk8lJL0CUebqK164= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -322,10 +266,10 @@ gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= -google.golang.org/genproto/googleapis/rpc v0.0.0-20260504160031-60b97b32f348 h1:pfIbyB44sWzHiCpRqIen67ZQnVXSfIxWrqUMk1qwODE= -google.golang.org/genproto/googleapis/rpc v0.0.0-20260504160031-60b97b32f348/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8= -google.golang.org/grpc v1.81.0 h1:W3G9N3KQf3BU+YuCtGKJk0CmxQNbAISICD/9AORxLIw= -google.golang.org/grpc v1.81.0/go.mod h1:xGH9GfzOyMTGIOXBJmXt+BX/V0kcdQbdcuwQ/zNw42I= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260414002931-afd174a4e478 h1:RmoJA1ujG+/lRGNfUnOMfhCy5EipVMyvUE+KNbPbTlw= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260414002931-afd174a4e478/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8= +google.golang.org/grpc v1.80.0 h1:Xr6m2WmWZLETvUNvIUmeD5OAagMw3FiKmMlTdViWsHM= +google.golang.org/grpc v1.80.0/go.mod h1:ho/dLnxwi3EDJA4Zghp7k2Ec1+c2jqup0bFkw07bwF4= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= @@ -336,9 +280,6 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntN gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sample/alpha-from-registry/sqlserver.tf b/sample/alpha-from-registry/sqlserver.tf new file mode 100644 index 00000000..2bf17a9e --- /dev/null +++ b/sample/alpha-from-registry/sqlserver.tf @@ -0,0 +1,101 @@ +# resource "stackit_kms_keyring" "keyring001" { +# project_id = var.project_id +# display_name = "msh-keyring-sna01" +# description = "This is a test keyring for private endpoints" +# } +# +# resource "stackit_kms_key" "key001" { +# project_id = var.project_id +# keyring_id = stackit_kms_keyring.keyring001.keyring_id +# display_name = "msh-key-sna01" +# protection = "software" +# algorithm = "aes_256_gcm" +# purpose = "symmetric_encrypt_decrypt" +# access_scope = "SNA" +# } + +data "stackitprivatepreview_sqlserverflexbeta_flavor" "sqlserver_flavor" { + project_id = var.project_id + region = "eu01" + cpu = 4 + ram = 16 + node_type = "Single" + storage_class = "premium-perf2-stackit" +} + +resource "stackitprivatepreview_sqlserverflexbeta_instance" "msh-sna-001" { + project_id = var.project_id + name = "msh-sna-001" + backup_schedule = "0 3 * * *" + retention_days = 31 + flavor_id = data.stackitprivatepreview_sqlserverflexbeta_flavor.sqlserver_flavor.flavor_id + storage = { + class = "premium-perf2-stackit" + size = 50 + } + version = 2022 + encryption = { + kek_key_version = 1 + kek_key_id = var.key_id + kek_key_ring_id = var.keyring_id + service_account = var.sa_email + } + network = { + acl = ["0.0.0.0/0", "193.148.160.0/19"] + access_scope = "SNA" + } +} + +#resource "stackitprivatepreview_sqlserverflexbeta_instance" "msh-nosna-001" { +# project_id = var.project_id +# name = "msh-nosna-001" +# backup_schedule = "0 3 * * *" +# retention_days = 31 +# flavor_id = data.stackitprivatepreview_sqlserverflexbeta_flavor.sqlserver_flavor.flavor_id +# storage = { +# class = "premium-perf2-stackit" +# size = 50 +# } +# version = 2022 +# # encryption = { +# # #key_id = stackit_kms_key.key.key_id +# # #keyring_id = stackit_kms_keyring.keyring.keyring_id +# # #key_version = 1 +# # #key_id = var.key_id +# # # key with scope public +# # key_id = "fe039bcf-8d7b-431a-801d-9e81371a6b7b" +# # keyring_id = var.keyring_id +# # key_version = var.key_version +# # service_account = var.sa_email +# # } +# network = { +# acl = ["0.0.0.0/0", "193.148.160.0/19"] +# access_scope = "PUBLIC" +# } +#} + +# data "stackitprivatepreview_sqlserverflexbeta_instance" "test" { +# project_id = var.project_id +# instance_id = var.instance_id +# region = "eu01" +# } + +# output "test" { +# value = data.stackitprivatepreview_sqlserverflexbeta_instance.test +# } + +resource "stackitprivatepreview_sqlserverflexbeta_user" "ptlsdbadminuser" { + project_id = var.project_id + instance_id = stackitprivatepreview_sqlserverflexbeta_instance.msh-sna-001.instance_id + username = var.db_admin_username + #roles = ["##STACKIT_LoginManager##", "##STACKIT_DatabaseManager##"] + roles = ["##STACKIT_LoginManager##"] +} + +resource "stackitprivatepreview_sqlserverflexbeta_user" "ptlsdbuser" { + project_id = var.project_id + instance_id = stackitprivatepreview_sqlserverflexbeta_instance.msh-sna-001.instance_id + username = var.db_username + roles = ["##STACKIT_LoginManager##"] +} + diff --git a/sample/postgres/postresql.tf b/sample/postgres/postresql.tf index 8679c669..531b17e2 100644 --- a/sample/postgres/postresql.tf +++ b/sample/postgres/postresql.tf @@ -13,11 +13,7 @@ resource "stackitprivatepreview_postgresflexalpha_instance" "msh-sna-pe-example" name = "mshpetest2" backup_schedule = "0 0 * * *" retention_days = 45 - # flavor_id = data.stackitprivatepreview_postgresflexalpha_flavor.pgsql_flavor.flavor_id - flavor = { - cpu = 2 - ram = 4 - } + flavor_id = data.stackitprivatepreview_postgresflexalpha_flavor.pgsql_flavor.flavor_id replicas = 1 storage = { # class = "premium-perf2-stackit" @@ -70,8 +66,7 @@ resource "stackitprivatepreview_postgresflexalpha_user" "ptlsdbadminuser" { project_id = var.project_id instance_id = stackitprivatepreview_postgresflexalpha_instance.msh-sna-pe-example.instance_id name = var.db_admin_username - roles = ["createdb", "login"] - # roles = ["createdb", "login", "login"] + roles = ["createdb", "login", "login"] # roles = ["createdb", "login", "createrole"] } @@ -115,11 +110,7 @@ output "psql_user_password" { sensitive = true } -# output "psql_user_conn" { -# value = stackitprivatepreview_postgresflexalpha_user.ptlsdbuser.connection.host -# sensitive = true -# } - -output "determined_flavor_id" { - value = stackitprivatepreview_postgresflexalpha_instance.msh-sna-pe-example.flavor_id +output "psql_user_conn" { + value = stackitprivatepreview_postgresflexalpha_user.ptlsdbuser.connection_string + sensitive = true } diff --git a/sample/tf.sh b/sample/tf.sh index 5b650bdc..8feaf799 100755 --- a/sample/tf.sh +++ b/sample/tf.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash + + # ./tf.sh apply > >(tee -a stdout.log) 2> >(tee -a stderr.log >&2) usage() { @@ -10,8 +12,7 @@ usage() { [ $# -eq 0 ] && usage CONFIG_FOLDER=$(dirname "$0") -# BINARY=terraform -BINARY=tofu +BINARY=terraform ADD="" diff --git a/service_specs/sqlserverflex/alpha/collations_config.yml b/service_specs/sqlserverflex/alpha/collation_config.yml.bak similarity index 100% rename from service_specs/sqlserverflex/alpha/collations_config.yml rename to service_specs/sqlserverflex/alpha/collation_config.yml.bak diff --git a/service_specs/sqlserverflex/alpha/versions_config.yml b/service_specs/sqlserverflex/alpha/version_config.yml.bak similarity index 100% rename from service_specs/sqlserverflex/alpha/versions_config.yml rename to service_specs/sqlserverflex/alpha/version_config.yml.bak diff --git a/service_specs/sqlserverflex/beta/collations_config.yml b/service_specs/sqlserverflex/beta/collation_config.yml.disabled similarity index 92% rename from service_specs/sqlserverflex/beta/collations_config.yml rename to service_specs/sqlserverflex/beta/collation_config.yml.disabled index 3d5fbb69..d1160ec3 100644 --- a/service_specs/sqlserverflex/beta/collations_config.yml +++ b/service_specs/sqlserverflex/beta/collation_config.yml.disabled @@ -2,7 +2,7 @@ provider: name: stackitprivatepreview data_sources: - collations: + collation: read: path: /v3beta1/projects/{projectId}/regions/{region}/instances/{instanceId}/collations method: GET diff --git a/service_specs/sqlserverflex/beta/versions_config.yml b/service_specs/sqlserverflex/beta/versions_config.yml index c1ed0b00..70d79676 100644 --- a/service_specs/sqlserverflex/beta/versions_config.yml +++ b/service_specs/sqlserverflex/beta/versions_config.yml @@ -3,7 +3,7 @@ provider: name: stackitprivatepreview data_sources: - versions: + version: read: path: /v3beta1/projects/{projectId}/regions/{region}/versions method: GET diff --git a/stackit/internal/services/postgresflexalpha/flavor/datasource.go b/stackit/internal/services/postgresflexalpha/flavor/datasource.go index ee7177f6..455baf14 100644 --- a/stackit/internal/services/postgresflexalpha/flavor/datasource.go +++ b/stackit/internal/services/postgresflexalpha/flavor/datasource.go @@ -11,7 +11,7 @@ import ( "github.com/stackitcloud/stackit-sdk-go/services/postgresflex/v3alpha1api" "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/conversion" - postgresflexalphaGen "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha/flavor/datasources_gen" + postgresflexalphaGen "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha/flavors/datasources_gen" postgresflexUtils "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha/utils" "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/utils" @@ -220,24 +220,14 @@ func (r *flavorDataSource) Read(ctx context.Context, req datasource.ReadRequest, } else { var scList []attr.Value for _, sc := range f.StorageClasses { - mIop := types.Int32Null() - if val, ok := sc.GetMaxIoPerSecOk(); ok { - mIop = types.Int32Value(*val) - } - - mThrough := types.Int32Null() - if val, ok := sc.GetMaxThroughInMbOk(); ok { - mThrough = types.Int32Value(*val) - } - scList = append( scList, postgresflexalphaGen.NewStorageClassesValueMust( postgresflexalphaGen.StorageClassesValue{}.AttributeTypes(ctx), map[string]attr.Value{ "class": types.StringValue(sc.Class), - "max_io_per_sec": mIop, - "max_through_in_mb": mThrough, + "max_io_per_sec": types.Int32Value(sc.MaxIoPerSec), + "max_through_in_mb": types.Int32Value(sc.MaxThroughInMb), }, ), ) diff --git a/stackit/internal/services/postgresflexalpha/flavors/datasource.go b/stackit/internal/services/postgresflexalpha/flavors/datasource.go index c70ec173..f5c99a82 100644 --- a/stackit/internal/services/postgresflexalpha/flavors/datasource.go +++ b/stackit/internal/services/postgresflexalpha/flavors/datasource.go @@ -1,4 +1,4 @@ -package postgresflexalphaflavors +package postgresflexalpha import ( "context" diff --git a/stackit/internal/services/postgresflexalpha/flavors/functions.go b/stackit/internal/services/postgresflexalpha/flavors/functions.go deleted file mode 100644 index 2135f8d0..00000000 --- a/stackit/internal/services/postgresflexalpha/flavors/functions.go +++ /dev/null @@ -1,65 +0,0 @@ -package postgresflexalphaflavors - -import ( - "context" - "fmt" - - "github.com/stackitcloud/stackit-sdk-go/services/postgresflex/v3alpha1api" -) - -type flavorsClientReader interface { - GetFlavorsRequest( - ctx context.Context, - projectId, region string, - ) v3alpha1api.ApiGetFlavorsRequestRequest -} - -func getAllFlavors(ctx context.Context, client flavorsClientReader, projectId, region string) ( - []v3alpha1api.ListFlavors, - error, -) { - getAllFilter := func(_ v3alpha1api.ListFlavors) bool { return true } - flavorList, err := getFlavorsByFilter(ctx, client, projectId, region, getAllFilter) - if err != nil { - return nil, err - } - return flavorList, nil -} - -// getFlavorsByFilter is a helper function to retrieve flavors using a filtern function. -// Hint: The API does not have a GetFlavors endpoint, only ListFlavors -func getFlavorsByFilter( - ctx context.Context, - client flavorsClientReader, - projectId, region string, - filter func(db v3alpha1api.ListFlavors) bool, -) ([]v3alpha1api.ListFlavors, error) { - if projectId == "" || region == "" { - return nil, fmt.Errorf("listing postgresflex flavors: projectId and region are required") - } - - const pageSize = 25 - - var result = make([]v3alpha1api.ListFlavors, 0) - - for page := int32(1); ; page++ { - res, err := client.GetFlavorsRequest(ctx, projectId, region). - Page(page).Size(pageSize).Sort(v3alpha1api.FLAVORSORT_ID_ASC).Execute() - if err != nil { - return nil, fmt.Errorf("requesting flavors list (page %d): %w", page, err) - } - - // If the API returns no flavors, we have reached the end of the list. - if len(res.Flavors) == 0 { - break - } - - for _, flavor := range res.Flavors { - if filter(flavor) { - result = append(result, flavor) - } - } - } - - return result, nil -} diff --git a/stackit/internal/services/postgresflexalpha/flavors/functions_test.go b/stackit/internal/services/postgresflexalpha/flavors/functions_test.go deleted file mode 100644 index 8ca78e1f..00000000 --- a/stackit/internal/services/postgresflexalpha/flavors/functions_test.go +++ /dev/null @@ -1,135 +0,0 @@ -package postgresflexalphaflavors - -/* -import ( - "context" - "testing" - - postgresflex "github.com/stackitcloud/stackit-sdk-go/services/postgresflex/v3alpha1api" -) - -type mockRequest struct { - executeFunc func() (*postgresflex.GetFlavorsResponse, error) -} - -func (m *mockRequest) Page(_ int32) postgresflex.ApiGetFlavorsRequestRequest { return m } -func (m *mockRequest) Size(_ int32) postgresflex.ApiGetFlavorsRequestRequest { return m } -func (m *mockRequest) Sort(_ postgresflex.FlavorSort) postgresflex.ApiGetFlavorsRequestRequest { - return m -} -func (m *mockRequest) Execute() (*postgresflex.GetFlavorsResponse, error) { - return m.executeFunc() -} - -type mockFlavorsClient struct { - executeRequest func() postgresflex.ApiGetFlavorsRequestRequest -} - -func (m *mockFlavorsClient) GetFlavorsRequest(_ context.Context, _, _ string) postgresflex.ApiGetFlavorsRequestRequest { - return m.executeRequest() -} - -var mockResp = func(page int32) (*postgresflex.GetFlavorsResponse, error) { - if page == 1 { - return &postgresflex.GetFlavorsResponse{ - Flavors: []postgresflex.ListFlavors{ - {Id: "flavor-1", Description: "first"}, - {Id: "flavor-2", Description: "second"}, - }, - }, nil - } - if page == 2 { - return &postgresflex.GetFlavorsResponse{ - Flavors: []postgresflex.ListFlavors{ - {Id: "flavor-3", Description: "three"}, - }, - }, nil - } - - return &postgresflex.GetFlavorsResponse{ - Flavors: []postgresflex.ListFlavors{}, - }, nil -} - -func TestGetFlavorsByFilter(t *testing.T) { - tests := []struct { - description string - projectId string - region string - mockErr error - filter func(postgresflex.ListFlavors) bool - wantCount int - wantErr bool - }{ - { - description: "Success - Get all flavors (2 pages)", - projectId: "pid", region: "reg", - filter: func(_ postgresflex.ListFlavors) bool { return true }, - wantCount: 3, - wantErr: false, - }, - { - description: "Success - Filter flavors by description", - projectId: "pid", region: "reg", - filter: func(f postgresflex.ListFlavors) bool { return f.Description == "first" }, - wantCount: 1, - wantErr: false, - }, - { - description: "Error - Missing parameters", - projectId: "", region: "reg", - wantErr: true, - }, - } - - for _, tt := range tests { - t.Run( - tt.description, func(t *testing.T) { - var currentPage int32 - client := &mockFlavorsClient{ - executeRequest: func() postgresflex.ApiGetFlavorsRequestRequest { - return mockRequest{ - executeFunc: func() (*postgresflex.GetFlavorsResponse, error) { - currentPage++ - return mockResp(currentPage) - }, - } - }, - } - actual, err := getFlavorsByFilter(context.Background(), client, tt.projectId, tt.region, tt.filter) - - if (err != nil) != tt.wantErr { - t.Errorf("getFlavorsByFilter() error = %v, wantErr %v", err, tt.wantErr) - return - } - - if !tt.wantErr && len(actual) != tt.wantCount { - t.Errorf("getFlavorsByFilter() got %d flavors, want %d", len(actual), tt.wantCount) - } - }, - ) - } -} - -func TestGetAllFlavors(t *testing.T) { - var currentPage int32 - client := &mockFlavorsClient{ - executeRequest: func() postgresflex.ApiGetFlavorsRequestRequest { - return mockRequest{ - executeFunc: func() (*postgresflex.GetFlavorsResponse, error) { - currentPage++ - return mockResp(currentPage) - }, - } - }, - } - - res, err := getAllFlavors(context.Background(), client, "pid", "reg") - if err != nil { - t.Errorf("getAllFlavors() unexpected error: %v", err) - } - if len(res) != 3 { - t.Errorf("getAllFlavors() expected 3 flavor, got %d", len(res)) - } -} -*/ diff --git a/stackit/internal/services/postgresflexalpha/instance/datasources_gen/instance_data_source_gen.go b/stackit/internal/services/postgresflexalpha/instance/datasources_gen/instance_data_source_gen.go index 587d2d89..9b3e28ce 100644 --- a/stackit/internal/services/postgresflexalpha/instance/datasources_gen/instance_data_source_gen.go +++ b/stackit/internal/services/postgresflexalpha/instance/datasources_gen/instance_data_source_gen.go @@ -115,12 +115,6 @@ func InstanceDataSourceSchema(ctx context.Context) schema.Schema { Description: "Whether the instance can be deleted or not.", MarkdownDescription: "Whether the instance can be deleted or not.", }, - "labels": schema.MapAttribute{ - ElementType: types.StringType, - Computed: true, - Description: "Key-value pairs, 63 characters max, begin and end with an alphanumerical character,\nmay contain dashes (-), underscores (_), dots (.), and alphanumerics between. Key MUST be at least 1 character.\nMax 64 labels\nRegex for keys: ^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$\nRegex for values: ^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$\nThe stackit- prefix is reserved and cannot be used for Keys.\n", - MarkdownDescription: "Key-value pairs, 63 characters max, begin and end with an alphanumerical character,\nmay contain dashes (-), underscores (_), dots (.), and alphanumerics between. Key MUST be at least 1 character.\nMax 64 labels\nRegex for keys: ^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$\nRegex for values: ^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$\nThe stackit- prefix is reserved and cannot be used for Keys.\n", - }, "name": schema.StringAttribute{ Computed: true, Description: "The name of the instance.", @@ -177,8 +171,8 @@ func InstanceDataSourceSchema(ctx context.Context) schema.Schema { }, "retention_days": schema.Int64Attribute{ Computed: true, - Description: "How long backups are retained. The value can only be between 32 and 90 days.", - MarkdownDescription: "How long backups are retained. The value can only be between 32 and 90 days.", + Description: "How long backups are retained. The value can only be between 32 and 365 days.", + MarkdownDescription: "How long backups are retained. The value can only be between 32 and 365 days.", }, "status": schema.StringAttribute{ Computed: true, @@ -225,7 +219,6 @@ type InstanceModel struct { Id types.String `tfsdk:"tf_original_api_id"` InstanceId types.String `tfsdk:"instance_id"` IsDeletable types.Bool `tfsdk:"is_deletable"` - Labels types.Map `tfsdk:"labels"` Name types.String `tfsdk:"name"` Network NetworkValue `tfsdk:"network"` ProjectId types.String `tfsdk:"project_id"` diff --git a/stackit/internal/services/postgresflexalpha/instance/flavor_functions.go b/stackit/internal/services/postgresflexalpha/instance/flavor_functions.go deleted file mode 100644 index a9d86e38..00000000 --- a/stackit/internal/services/postgresflexalpha/instance/flavor_functions.go +++ /dev/null @@ -1,65 +0,0 @@ -package postgresflexalpha - -import ( - "context" - "fmt" - - "github.com/stackitcloud/stackit-sdk-go/services/postgresflex/v3alpha1api" -) - -type flavorsClientReader interface { - GetFlavorsRequest( - ctx context.Context, - projectId, region string, - ) v3alpha1api.ApiGetFlavorsRequestRequest -} - -func getAllFlavors(ctx context.Context, client flavorsClientReader, projectId, region string) ( - []v3alpha1api.ListFlavors, - error, -) { - getAllFilter := func(_ v3alpha1api.ListFlavors) bool { return true } - flavorList, err := getFlavorsByFilter(ctx, client, projectId, region, getAllFilter) - if err != nil { - return nil, err - } - return flavorList, nil -} - -// getFlavorsByFilter is a helper function to retrieve flavors using a filtern function. -// Hint: The API does not have a GetFlavors endpoint, only ListFlavors -func getFlavorsByFilter( - ctx context.Context, - client flavorsClientReader, - projectId, region string, - filter func(db v3alpha1api.ListFlavors) bool, -) ([]v3alpha1api.ListFlavors, error) { - if projectId == "" || region == "" { - return nil, fmt.Errorf("listing postgresflex flavors: projectId and region are required") - } - - const pageSize = 25 - - var result = make([]v3alpha1api.ListFlavors, 0) - - for page := int32(1); ; page++ { - res, err := client.GetFlavorsRequest(ctx, projectId, region). - Page(page).Size(pageSize).Sort(v3alpha1api.FLAVORSORT_ID_ASC).Execute() - if err != nil { - return nil, fmt.Errorf("requesting flavors list (page %d): %w", page, err) - } - - // If the API returns no flavors, we have reached the end of the list. - if len(res.Flavors) == 0 { - break - } - - for _, flavor := range res.Flavors { - if filter(flavor) { - result = append(result, flavor) - } - } - } - - return result, nil -} diff --git a/stackit/internal/services/postgresflexalpha/instance/flavor_functions_test.go b/stackit/internal/services/postgresflexalpha/instance/flavor_functions_test.go deleted file mode 100644 index 6fbd8c2f..00000000 --- a/stackit/internal/services/postgresflexalpha/instance/flavor_functions_test.go +++ /dev/null @@ -1,135 +0,0 @@ -package postgresflexalpha - -/* -import ( - "context" - "testing" - - postgresflex "github.com/stackitcloud/stackit-sdk-go/services/postgresflex/v3alpha1api" -) - -type mockRequest struct { - executeFunc func() (*postgresflex.GetFlavorsResponse, error) -} - -func (m *mockRequest) Page(_ int32) postgresflex.ApiGetFlavorsRequestRequest { return m } -func (m *mockRequest) Size(_ int32) postgresflex.ApiGetFlavorsRequestRequest { return m } -func (m *mockRequest) Sort(_ postgresflex.FlavorSort) postgresflex.ApiGetFlavorsRequestRequest { - return m -} -func (m *mockRequest) Execute() (*postgresflex.GetFlavorsResponse, error) { - return m.executeFunc() -} - -type mockFlavorsClient struct { - executeRequest func() postgresflex.ApiGetFlavorsRequestRequest -} - -func (m *mockFlavorsClient) GetFlavorsRequest(_ context.Context, _, _ string) postgresflex.ApiGetFlavorsRequestRequest { - return m.executeRequest() -} - -var mockResp = func(page int32) (*postgresflex.GetFlavorsResponse, error) { - if page == 1 { - return &postgresflex.GetFlavorsResponse{ - Flavors: []postgresflex.ListFlavors{ - {Id: "flavor-1", Description: "first"}, - {Id: "flavor-2", Description: "second"}, - }, - }, nil - } - if page == 2 { - return &postgresflex.GetFlavorsResponse{ - Flavors: []postgresflex.ListFlavors{ - {Id: "flavor-3", Description: "three"}, - }, - }, nil - } - - return &postgresflex.GetFlavorsResponse{ - Flavors: []postgresflex.ListFlavors{}, - }, nil -} - -func TestGetFlavorsByFilter(t *testing.T) { - tests := []struct { - description string - projectId string - region string - mockErr error - filter func(postgresflex.ListFlavors) bool - wantCount int - wantErr bool - }{ - { - description: "Success - Get all flavors (2 pages)", - projectId: "pid", region: "reg", - filter: func(_ postgresflex.ListFlavors) bool { return true }, - wantCount: 3, - wantErr: false, - }, - { - description: "Success - Filter flavors by description", - projectId: "pid", region: "reg", - filter: func(f postgresflex.ListFlavors) bool { return f.Description == "first" }, - wantCount: 1, - wantErr: false, - }, - { - description: "Error - Missing parameters", - projectId: "", region: "reg", - wantErr: true, - }, - } - - for _, tt := range tests { - t.Run( - tt.description, func(t *testing.T) { - var currentPage int32 - client := &mockFlavorsClient{ - executeRequest: func() postgresflex.ApiGetFlavorsRequestRequest { - return mockRequest{ - executeFunc: func() (*postgresflex.GetFlavorsResponse, error) { - currentPage++ - return mockResp(currentPage) - }, - } - }, - } - actual, err := getFlavorsByFilter(context.Background(), client, tt.projectId, tt.region, tt.filter) - - if (err != nil) != tt.wantErr { - t.Errorf("getFlavorsByFilter() error = %v, wantErr %v", err, tt.wantErr) - return - } - - if !tt.wantErr && len(actual) != tt.wantCount { - t.Errorf("getFlavorsByFilter() got %d flavors, want %d", len(actual), tt.wantCount) - } - }, - ) - } -} - -func TestGetAllFlavors(t *testing.T) { - var currentPage int32 - client := &mockFlavorsClient{ - executeRequest: func() postgresflex.ApiGetFlavorsRequestRequest { - return mockRequest{ - executeFunc: func() (*postgresflex.GetFlavorsResponse, error) { - currentPage++ - return mockResp(currentPage) - }, - } - }, - } - - res, err := getAllFlavors(context.Background(), client, "pid", "reg") - if err != nil { - t.Errorf("getAllFlavors() unexpected error: %v", err) - } - if len(res) != 3 { - t.Errorf("getAllFlavors() expected 3 flavor, got %d", len(res)) - } -} -*/ diff --git a/stackit/internal/services/postgresflexalpha/instance/functions.go b/stackit/internal/services/postgresflexalpha/instance/functions.go index ad67ba3d..1eb10d32 100644 --- a/stackit/internal/services/postgresflexalpha/instance/functions.go +++ b/stackit/internal/services/postgresflexalpha/instance/functions.go @@ -16,7 +16,7 @@ import ( func mapGetInstanceResponseToModel( ctx context.Context, - m *LocalInstanceModel, + m *postgresflexalpharesource.InstanceModel, resp *postgresflex.GetInstanceResponse, ) error { m.BackupSchedule = types.StringValue(resp.GetBackupSchedule()) @@ -71,8 +71,6 @@ func mapGetInstanceResponseToModel( m.Acl = netACL - // m.Labels = resp.GetLabels() - netInstAdd := types.StringValue("") if instAdd, ok := resp.Network.GetInstanceAddressOk(); ok { netInstAdd = types.StringValue(*instAdd) diff --git a/stackit/internal/services/postgresflexalpha/instance/functions_test.go b/stackit/internal/services/postgresflexalpha/instance/functions_test.go index 1a7d495b..0fa85f16 100644 --- a/stackit/internal/services/postgresflexalpha/instance/functions_test.go +++ b/stackit/internal/services/postgresflexalpha/instance/functions_test.go @@ -8,6 +8,7 @@ import ( postgresflex "github.com/stackitcloud/stackit-sdk-go/services/postgresflex/v3alpha1api" + postgresflexalpharesource "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha/instance/resources_gen" utils2 "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/utils" ) @@ -170,7 +171,7 @@ func Test_mapGetInstanceResponseToModel(t *testing.T) { t.Skipf("please implement") type args struct { ctx context.Context - m *LocalInstanceModel + m *postgresflexalpharesource.InstanceModel resp *postgresflex.GetInstanceResponse } tests := []struct { diff --git a/stackit/internal/services/postgresflexalpha/instance/resource.go b/stackit/internal/services/postgresflexalpha/instance/resource.go index 52742195..ad99978e 100644 --- a/stackit/internal/services/postgresflexalpha/instance/resource.go +++ b/stackit/internal/services/postgresflexalpha/instance/resource.go @@ -11,14 +11,11 @@ import ( "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" "github.com/hashicorp/terraform-plugin-log/tflog" "github.com/stackitcloud/stackit-sdk-go/core/oapierror" coreUtils "github.com/stackitcloud/stackit-sdk-go/core/utils" "github.com/stackitcloud/stackit-sdk-go/services/postgresflex/v3alpha1api" + "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/conversion" "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/core" postgresflexalpha "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha/instance/resources_gen" @@ -47,25 +44,12 @@ type instanceResource struct { providerData core.ProviderData } -type LocalInstanceModel struct { - postgresflexalpha.InstanceModel - Flavor types.Object `tfsdk:"flavor"` -} - -// Struct corresponding to Model.Flavor -type flavorModel struct { - Id types.String `tfsdk:"id"` - Description types.String `tfsdk:"description"` - CPU types.Int64 `tfsdk:"cpu"` - RAM types.Int64 `tfsdk:"ram"` -} - func (r *instanceResource) ValidateConfig( ctx context.Context, req resource.ValidateConfigRequest, resp *resource.ValidateConfigResponse, ) { - var data LocalInstanceModel + var data postgresflexalpha.InstanceModel resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) if resp.Diagnostics.HasError() { @@ -80,23 +64,6 @@ func (r *instanceResource) ValidateConfig( "The resource may return unexpected results.", ) } - - if data.FlavorId.IsNull() { - if data.Flavor.IsUnknown() || data.Flavor.IsNull() { - resp.Diagnostics.AddAttributeError( - path.Root("flavor"), - "Missing Attribute Configuration", - "Expected flavor to be configured. "+ - "The resource may return unexpected results.", - ) - } - resp.Diagnostics.AddAttributeWarning( - path.Root("flavor"), - "Attribute Configuration Deprecation", - "Using flavor is deprecated, "+ - "please use flavor_id instead.", - ) - } } // ModifyPlan implements resource.ResourceWithModifyPlan. @@ -106,7 +73,7 @@ func (r *instanceResource) ModifyPlan( req resource.ModifyPlanRequest, resp *resource.ModifyPlanResponse, ) { // nolint:gocritic // function signature required by Terraform - var configModel LocalInstanceModel + var configModel postgresflexalpha.InstanceModel // skip initial empty configuration to avoid follow-up errors if req.Config.Raw.IsNull() { return @@ -116,7 +83,7 @@ func (r *instanceResource) ModifyPlan( return } - var planModel LocalInstanceModel + var planModel postgresflexalpha.InstanceModel resp.Diagnostics.Append(req.Plan.Get(ctx, &planModel)...) if resp.Diagnostics.HasError() { return @@ -166,53 +133,20 @@ func (r *instanceResource) Configure( var modifiersFileByte []byte // Schema defines the schema for the resource. -func (r *instanceResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { - schemaVar := postgresflexalpha.InstanceResourceSchema(ctx) - schemaVar.Attributes["flavor"] = schema.SingleNestedAttribute{ - Optional: true, - DeprecationMessage: "Please use flavor_id instead.", - Attributes: map[string]schema.Attribute{ - "id": schema.StringAttribute{ - Computed: true, - PlanModifiers: []planmodifier.String{ - UseStateForUnknownIfFlavorUnchanged(req), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - PlanModifiers: []planmodifier.String{ - UseStateForUnknownIfFlavorUnchanged(req), - }, - }, - "cpu": schema.Int64Attribute{ - DeprecationMessage: "Please use flavor_id instead.", - Optional: true, - }, - "ram": schema.Int64Attribute{ - DeprecationMessage: "Please use flavor_id instead.", - Optional: true, - }, - }, - } - - schemaVar.Attributes["flavor_id"] = schema.StringAttribute{ - Optional: true, - Description: "The id of the instance flavor.", - MarkdownDescription: "The id of the instance flavor.", - } - +func (r *instanceResource) Schema(ctx context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) { + schema := postgresflexalpha.InstanceResourceSchema(ctx) fields, err := utils.ReadModifiersConfig(modifiersFileByte) if err != nil { resp.Diagnostics.AddError("error during read modifiers config file", err.Error()) return } - err = utils.AddPlanModifiersToResourceSchema(fields, &schemaVar) + err = utils.AddPlanModifiersToResourceSchema(fields, &schema) if err != nil { resp.Diagnostics.AddError("error adding plan modifiers", err.Error()) return } - resp.Schema = schemaVar + resp.Schema = schema } // Create creates the resource and sets the initial Terraform state. @@ -221,7 +155,7 @@ func (r *instanceResource) Create( req resource.CreateRequest, resp *resource.CreateResponse, ) { // nolint:gocritic // function signature required by Terraform - var model LocalInstanceModel + var model postgresflexalpha.InstanceModel diags := req.Plan.Get(ctx, &model) resp.Diagnostics.Append(diags...) @@ -243,73 +177,6 @@ func (r *instanceResource) Create( return } - // determine flavor ID - var flModel = &flavorModel{} - if !(model.Flavor.IsNull() || model.Flavor.IsUnknown()) { - diags = model.Flavor.As(ctx, flModel, basetypes.ObjectAsOptions{}) - resp.Diagnostics.Append(diags...) - if resp.Diagnostics.HasError() { - return - } - - flavors, err := getAllFlavors(ctx, r.client.DefaultAPI, projectID, region) - if err != nil { - core.LogAndAddError(ctx, &resp.Diagnostics, "Error reading flavors", fmt.Sprintf("getAllFlavors: %v", err)) - return - } - tflog.Debug(ctx, fmt.Sprintf("loaded flavors: %d", len(flavors))) - - var foundFlavors []v3alpha1api.ListFlavors - for _, flavor := range flavors { - if flModel.CPU.ValueInt64() != int64(flavor.Cpu) { - // tflog.Debug(ctx, fmt.Sprintf("flavor - cpu did not match (%d - %d)", flModel.CPU.ValueInt64(), flavor.Cpu)) - continue - } - if flModel.RAM.ValueInt64() != int64(flavor.Memory) { - // tflog.Debug(ctx, fmt.Sprintf("flavor - ram did not match (%d - %d)", flModel.RAM.ValueInt64(), flavor.Memory)) - continue - } - tmpNodeType := "Single" - if model.Replicas.ValueInt64() > 1 { - tmpNodeType = "Replica" - } - if strings.ToLower(tmpNodeType) != strings.ToLower(flavor.NodeType) { - //tflog.Debug( - // ctx, - // fmt.Sprintf( - // "flavor - nodeType did not match ('%s' - '%s')", - // strings.ToLower(tmpNodeType), - // strings.ToLower(flavor.NodeType), - // ), - //) - continue - } - tflog.Debug(ctx, fmt.Sprintf("found flavor %s, checking storage classes", flavor.Id)) - for _, sc := range flavor.StorageClasses { - if model.Storage.PerformanceClass.ValueString() != sc.Class { - continue - } - tflog.Debug(ctx, fmt.Sprintf("found storage class '%s' for flavor '%s', checking storage classes", sc.Class, flavor.Id)) - foundFlavors = append(foundFlavors, flavor) - } - } - if len(foundFlavors) == 0 { - resp.Diagnostics.AddError("get flavor", "could not find requested flavor") - return - } - if len(foundFlavors) > 1 { - resp.Diagnostics.AddError("get flavor", "found too many matching flavors") - return - } - - f := foundFlavors[0] - flModel.Description = types.StringValue(f.Description) - flModel.Id = utils.BuildInternalTerraformId(model.ProjectId.ValueString(), region, f.Id) - model.FlavorId = types.StringValue(f.Id) - //flModel. .MaxGb = types.Int32Value(f.MaxGB) - //flModel.MinGb = types.Int32Value(f.MinGB) - } - replVal := model.Replicas.ValueInt64() // nolint:gosec // check is performed above payload := modelToCreateInstancePayload(netACL, model, replVal) @@ -376,7 +243,7 @@ func (r *instanceResource) Create( func modelToCreateInstancePayload( netACL []string, - model LocalInstanceModel, + model postgresflexalpha.InstanceModel, replVal int64, ) v3alpha1api.CreateInstanceRequestPayload { var enc *v3alpha1api.InstanceEncryption @@ -416,7 +283,7 @@ func (r *instanceResource) Read( ) { // nolint:gocritic // function signature required by Terraform functionErrorSummary := "read instance failed" - var model LocalInstanceModel + var model postgresflexalpha.InstanceModel diags := req.State.Get(ctx, &model) resp.Diagnostics.Append(diags...) if resp.Diagnostics.HasError() { @@ -504,7 +371,7 @@ func (r *instanceResource) Update( req resource.UpdateRequest, resp *resource.UpdateResponse, ) { // nolint:gocritic // function signature required by Terraform - var model LocalInstanceModel + var model postgresflexalpha.InstanceModel diags := req.Plan.Get(ctx, &model) resp.Diagnostics.Append(diags...) @@ -617,7 +484,7 @@ func (r *instanceResource) Delete( req resource.DeleteRequest, resp *resource.DeleteResponse, ) { // nolint:gocritic // function signature required by Terraform - var model LocalInstanceModel + var model postgresflexalpha.InstanceModel diags := req.State.Get(ctx, &model) resp.Diagnostics.Append(diags...) diff --git a/stackit/internal/services/postgresflexalpha/instance/resources_gen/instance_resource_gen.go b/stackit/internal/services/postgresflexalpha/instance/resources_gen/instance_resource_gen.go index 7483dd67..7d7969a6 100644 --- a/stackit/internal/services/postgresflexalpha/instance/resources_gen/instance_resource_gen.go +++ b/stackit/internal/services/postgresflexalpha/instance/resources_gen/instance_resource_gen.go @@ -119,13 +119,6 @@ func InstanceResourceSchema(ctx context.Context) schema.Schema { Description: "Whether the instance can be deleted or not.", MarkdownDescription: "Whether the instance can be deleted or not.", }, - //"labels": schema.MapAttribute{ - // ElementType: types.StringType, - // Optional: true, - // Computed: true, - // Description: "Key-value pairs, 63 characters max, begin and end with an alphanumerical character,\nmay contain dashes (-), underscores (_), dots (.), and alphanumerics between. Key MUST be at least 1 character.\nMax 64 labels\nRegex for keys: ^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$\nRegex for values: ^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$\nThe stackit- prefix is reserved and cannot be used for Keys.\n", - // MarkdownDescription: "Key-value pairs, 63 characters max, begin and end with an alphanumerical character,\nmay contain dashes (-), underscores (_), dots (.), and alphanumerics between. Key MUST be at least 1 character.\nMax 64 labels\nRegex for keys: ^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$\nRegex for values: ^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$\nThe stackit- prefix is reserved and cannot be used for Keys.\n", - //}, "name": schema.StringAttribute{ Required: true, Description: "The name of the instance.", @@ -198,8 +191,8 @@ func InstanceResourceSchema(ctx context.Context) schema.Schema { }, "retention_days": schema.Int64Attribute{ Required: true, - Description: "How long backups are retained. The value can only be between 32 and 90 days.", - MarkdownDescription: "How long backups are retained. The value can only be between 32 and 90 days.", + Description: "How long backups are retained. The value can only be between 32 and 365 days.", + MarkdownDescription: "How long backups are retained. The value can only be between 32 and 365 days.", }, "status": schema.StringAttribute{ Computed: true, @@ -246,16 +239,15 @@ type InstanceModel struct { Id types.String `tfsdk:"id"` InstanceId types.String `tfsdk:"instance_id"` IsDeletable types.Bool `tfsdk:"is_deletable"` - //Labels types.Map `tfsdk:"labels"` - Name types.String `tfsdk:"name"` - Network NetworkValue `tfsdk:"network"` - ProjectId types.String `tfsdk:"project_id"` - Region types.String `tfsdk:"region"` - Replicas types.Int64 `tfsdk:"replicas"` - RetentionDays types.Int64 `tfsdk:"retention_days"` - Status types.String `tfsdk:"status"` - Storage StorageValue `tfsdk:"storage"` - Version types.String `tfsdk:"version"` + Name types.String `tfsdk:"name"` + Network NetworkValue `tfsdk:"network"` + ProjectId types.String `tfsdk:"project_id"` + Region types.String `tfsdk:"region"` + Replicas types.Int64 `tfsdk:"replicas"` + RetentionDays types.Int64 `tfsdk:"retention_days"` + Status types.String `tfsdk:"status"` + Storage StorageValue `tfsdk:"storage"` + Version types.String `tfsdk:"version"` } var _ basetypes.ObjectTypable = ConnectionInfoType{} diff --git a/stackit/internal/services/postgresflexalpha/instance/use_state_for_unknown_if_flavor_unchanged_modifier.go b/stackit/internal/services/postgresflexalpha/instance/use_state_for_unknown_if_flavor_unchanged_modifier.go deleted file mode 100644 index a6dfc1d3..00000000 --- a/stackit/internal/services/postgresflexalpha/instance/use_state_for_unknown_if_flavor_unchanged_modifier.go +++ /dev/null @@ -1,85 +0,0 @@ -package postgresflexalpha - -import ( - "context" - - "github.com/hashicorp/terraform-plugin-framework/resource" - "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" -) - -type useStateForUnknownIfFlavorUnchangedModifier struct { - Req resource.SchemaRequest -} - -// UseStateForUnknownIfFlavorUnchanged returns a plan modifier similar to UseStateForUnknown -// if the RAM and CPU values are not changed in the plan. Otherwise, the plan modifier does nothing. -func UseStateForUnknownIfFlavorUnchanged(req resource.SchemaRequest) planmodifier.String { - return useStateForUnknownIfFlavorUnchangedModifier{ - Req: req, - } -} - -func (m useStateForUnknownIfFlavorUnchangedModifier) Description(context.Context) string { - return "UseStateForUnknownIfFlavorUnchanged returns a plan modifier similar to UseStateForUnknown if the RAM and CPU values are not changed in the plan. Otherwise, the plan modifier does nothing." -} - -func (m useStateForUnknownIfFlavorUnchangedModifier) MarkdownDescription(ctx context.Context) string { - return m.Description(ctx) -} - -func (m useStateForUnknownIfFlavorUnchangedModifier) PlanModifyString(ctx context.Context, req planmodifier.StringRequest, resp *planmodifier.StringResponse) { // nolint:gocritic // function signature required by Terraform - // Do nothing if there is no state value. - if req.StateValue.IsNull() { - return - } - - // Do nothing if there is a known planned value. - if !req.PlanValue.IsUnknown() { - return - } - - // Do nothing if there is an unknown configuration value, otherwise interpolation gets messed up. - if req.ConfigValue.IsUnknown() { - return - } - - // The above checks are taken from the UseStateForUnknown plan modifier implementation - // (https://github.com/hashicorp/terraform-plugin-framework/blob/main/resource/schema/stringplanmodifier/use_state_for_unknown.go#L38) - - var stateModel LocalInstanceModel - diags := req.State.Get(ctx, &stateModel) - resp.Diagnostics.Append(diags...) - if resp.Diagnostics.HasError() { - return - } - - var stateFlavor = &flavorModel{} - if !(stateModel.Flavor.IsNull() || stateModel.Flavor.IsUnknown()) { - diags = stateModel.Flavor.As(ctx, stateFlavor, basetypes.ObjectAsOptions{}) - resp.Diagnostics.Append(diags...) - if resp.Diagnostics.HasError() { - return - } - } - - var planModel LocalInstanceModel - diags = req.Plan.Get(ctx, &planModel) - resp.Diagnostics.Append(diags...) - if resp.Diagnostics.HasError() { - return - } - - var planFlavor = &flavorModel{} - if !(planModel.Flavor.IsNull() || planModel.Flavor.IsUnknown()) { - diags = planModel.Flavor.As(ctx, planFlavor, basetypes.ObjectAsOptions{}) - resp.Diagnostics.Append(diags...) - if resp.Diagnostics.HasError() { - return - } - } - - if planFlavor.CPU == stateFlavor.CPU && planFlavor.RAM == stateFlavor.RAM { - resp.PlanValue = req.StateValue - } -} diff --git a/stackit/internal/services/postgresflexalpha/testdata/instance_template_with_flavor.gompl b/stackit/internal/services/postgresflexalpha/testdata/instance_template_with_flavor.gompl deleted file mode 100644 index 70d0692f..00000000 --- a/stackit/internal/services/postgresflexalpha/testdata/instance_template_with_flavor.gompl +++ /dev/null @@ -1,101 +0,0 @@ -provider "stackitprivatepreview" { - default_region = "{{ .Region }}" - service_account_key_path = "{{ .ServiceAccountFilePath }}" -} - -data "stackitprivatepreview_postgresflexalpha_flavor" "flavor" { - project_id = "{{ .ProjectID }}" - region = "{{ .Region }}" - cpu = 4 - ram = 16 - node_type = "Single" - storage_class = "premium-perf2-stackit" -} - -resource "stackitprivatepreview_postgresflexalpha_instance" "{{ .TfName }}" { - project_id = "{{ .ProjectID }}" - name = "{{ .Name }}" - backup_schedule = "{{ .BackupSchedule }}" - retention_days = {{ .RetentionDays }} - flavor_id = "{{ .FlavorID }}" - replicas = {{ .Replicas }} - storage = { - performance_class = "{{ .PerformanceClass }}" - size = {{ .Size }} - } -{{ if .UseEncryption }} - encryption = { - kek_key_id = "{{ .KekKeyID }}" - kek_key_ring_id = "{{ .KekKeyRingID }}" - kek_key_version = {{ .KekKeyVersion }} - service_account = "{{ .KekServiceAccount }}" - } -{{ end }} - network = { - acl = [{{ range $i, $v := .ACLStrings }}{{if $i}},{{end}}"{{$v}}"{{end}}] - access_scope = "{{ .AccessScope }}" - } -{{ if .Version }} - version = "{{ .Version }}" -{{ end }} -} - -{{ if .Users }} -{{ $tfName := .TfName }} -{{ range $user := .Users }} -resource "stackitprivatepreview_postgresflexalpha_user" "{{ $user.Name }}" { - depends_on = [ - stackitprivatepreview_postgresflexalpha_instance.{{ $tfName }} - ] - project_id = "{{ $user.ProjectID }}" - instance_id = stackitprivatepreview_postgresflexalpha_instance.{{ $tfName }}.instance_id - name = "{{ $user.Name }}" - roles = [{{ range $i, $v := $user.Roles }}{{if $i}},{{end}}"{{$v}}"{{end}}] -} -{{ end }} -{{ end }} - -{{ if .Databases }} -{{ $tfName := .TfName }} -{{ range $db := .Databases }} -resource "stackitprivatepreview_postgresflexalpha_database" "{{ $db.Name }}" { - depends_on = [ - stackitprivatepreview_postgresflexalpha_instance.{{ $tfName }}, - stackitprivatepreview_postgresflexalpha_user.{{ $db.Owner }} - ] - project_id = "{{ $db.ProjectID }}" - instance_id = stackitprivatepreview_postgresflexalpha_instance.{{ $tfName }}.instance_id - name = "{{ $db.Name }}" - owner = stackitprivatepreview_postgresflexalpha_user.{{ $db.Owner }}.name -} -{{ end }} -{{ end }} - -{{ if .DataSourceTest }} -data "stackitprivatepreview_postgresflexalpha_instance" "{{ .TfName }}" { - project_id = stackitprivatepreview_postgresflexalpha_instance.{{ .TfName }}.project_id - instance_id = stackitprivatepreview_postgresflexalpha_instance.{{ .TfName }}.instance_id -} - -{{ if .Users }} -{{ $tfName := .TfName }} -{{ range $user := .Users }} -data "stackitprivatepreview_postgresflexalpha_user" "{{ $user.Name }}" { - project_id = stackitprivatepreview_postgresflexalpha_instance.{{ $tfName }}.project_id - instance_id = stackitprivatepreview_postgresflexalpha_instance.{{ $tfName }}.instance_id - user_id = stackitprivatepreview_postgresflexalpha_user.{{ $user.Name }}.user_id -} -{{ end }} -{{ end }} - -{{ if .Databases }} -{{ $tfName := .TfName }} -{{ range $db := .Databases }} -data "stackitprivatepreview_postgresflexalpha_database" "{{ $db.Name }}" { - project_id = stackitprivatepreview_postgresflexalpha_instance.{{ $tfName }}.project_id - instance_id = stackitprivatepreview_postgresflexalpha_instance.{{ $tfName }}.instance_id - database_id = stackitprivatepreview_postgresflexalpha_database.{{ $db.Name }}.database_id -} -{{ end }} -{{ end }} -{{ end }} diff --git a/stackit/internal/services/postgresflexalpha/versions/datasources_gen/versions_data_source_gen.go b/stackit/internal/services/postgresflexalpha/version/datasources_gen/versions_data_source_gen.go similarity index 100% rename from stackit/internal/services/postgresflexalpha/versions/datasources_gen/versions_data_source_gen.go rename to stackit/internal/services/postgresflexalpha/version/datasources_gen/versions_data_source_gen.go diff --git a/stackit/internal/services/sqlserverflexalpha/collations/datasources_gen/collations_data_source_gen.go b/stackit/internal/services/sqlserverflexalpha/collations/datasources_gen/collations_data_source_gen.go deleted file mode 100644 index a0f13e40..00000000 --- a/stackit/internal/services/sqlserverflexalpha/collations/datasources_gen/collations_data_source_gen.go +++ /dev/null @@ -1,451 +0,0 @@ -// Code generated by terraform-plugin-framework-generator DO NOT EDIT. - -package sqlserverflexalpha - -import ( - "context" - "fmt" - "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" - "github.com/hashicorp/terraform-plugin-framework/attr" - "github.com/hashicorp/terraform-plugin-framework/diag" - "github.com/hashicorp/terraform-plugin-framework/schema/validator" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" - "github.com/hashicorp/terraform-plugin-go/tftypes" - "strings" - - "github.com/hashicorp/terraform-plugin-framework/datasource/schema" -) - -func CollationsDataSourceSchema(ctx context.Context) schema.Schema { - return schema.Schema{ - Attributes: map[string]schema.Attribute{ - "collations": schema.ListNestedAttribute{ - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "collation_name": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - }, - CustomType: CollationsType{ - ObjectType: types.ObjectType{ - AttrTypes: CollationsValue{}.AttributeTypes(ctx), - }, - }, - }, - Computed: true, - Description: "List of collations available for the instance.", - MarkdownDescription: "List of collations available for the instance.", - }, - "instance_id": schema.StringAttribute{ - Required: true, - Description: "The ID of the instance.", - MarkdownDescription: "The ID of the instance.", - }, - "project_id": schema.StringAttribute{ - Required: true, - Description: "The STACKIT project ID.", - MarkdownDescription: "The STACKIT project ID.", - }, - "region": schema.StringAttribute{ - Optional: true, - Description: "The region which should be addressed", - MarkdownDescription: "The region which should be addressed", - Validators: []validator.String{ - stringvalidator.OneOf( - "eu01", - ), - }, - }, - }, - } -} - -type CollationsModel struct { - Collations types.List `tfsdk:"collations"` - InstanceId types.String `tfsdk:"instance_id"` - ProjectId types.String `tfsdk:"project_id"` - Region types.String `tfsdk:"region"` -} - -var _ basetypes.ObjectTypable = CollationsType{} - -type CollationsType struct { - basetypes.ObjectType -} - -func (t CollationsType) Equal(o attr.Type) bool { - other, ok := o.(CollationsType) - - if !ok { - return false - } - - return t.ObjectType.Equal(other.ObjectType) -} - -func (t CollationsType) String() string { - return "CollationsType" -} - -func (t CollationsType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { - var diags diag.Diagnostics - - attributes := in.Attributes() - - collationNameAttribute, ok := attributes["collation_name"] - - if !ok { - diags.AddError( - "Attribute Missing", - `collation_name is missing from object`) - - return nil, diags - } - - collationNameVal, ok := collationNameAttribute.(basetypes.StringValue) - - if !ok { - diags.AddError( - "Attribute Wrong Type", - fmt.Sprintf(`collation_name expected to be basetypes.StringValue, was: %T`, collationNameAttribute)) - } - - descriptionAttribute, ok := attributes["description"] - - if !ok { - diags.AddError( - "Attribute Missing", - `description is missing from object`) - - return nil, diags - } - - descriptionVal, ok := descriptionAttribute.(basetypes.StringValue) - - if !ok { - diags.AddError( - "Attribute Wrong Type", - fmt.Sprintf(`description expected to be basetypes.StringValue, was: %T`, descriptionAttribute)) - } - - if diags.HasError() { - return nil, diags - } - - return CollationsValue{ - CollationName: collationNameVal, - Description: descriptionVal, - state: attr.ValueStateKnown, - }, diags -} - -func NewCollationsValueNull() CollationsValue { - return CollationsValue{ - state: attr.ValueStateNull, - } -} - -func NewCollationsValueUnknown() CollationsValue { - return CollationsValue{ - state: attr.ValueStateUnknown, - } -} - -func NewCollationsValue(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) (CollationsValue, diag.Diagnostics) { - var diags diag.Diagnostics - - // Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/521 - ctx := context.Background() - - for name, attributeType := range attributeTypes { - attribute, ok := attributes[name] - - if !ok { - diags.AddError( - "Missing CollationsValue Attribute Value", - "While creating a CollationsValue value, a missing attribute value was detected. "+ - "A CollationsValue must contain values for all attributes, even if null or unknown. "+ - "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ - fmt.Sprintf("CollationsValue Attribute Name (%s) Expected Type: %s", name, attributeType.String()), - ) - - continue - } - - if !attributeType.Equal(attribute.Type(ctx)) { - diags.AddError( - "Invalid CollationsValue Attribute Type", - "While creating a CollationsValue value, an invalid attribute value was detected. "+ - "A CollationsValue must use a matching attribute type for the value. "+ - "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ - fmt.Sprintf("CollationsValue Attribute Name (%s) Expected Type: %s\n", name, attributeType.String())+ - fmt.Sprintf("CollationsValue Attribute Name (%s) Given Type: %s", name, attribute.Type(ctx)), - ) - } - } - - for name := range attributes { - _, ok := attributeTypes[name] - - if !ok { - diags.AddError( - "Extra CollationsValue Attribute Value", - "While creating a CollationsValue value, an extra attribute value was detected. "+ - "A CollationsValue must not contain values beyond the expected attribute types. "+ - "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ - fmt.Sprintf("Extra CollationsValue Attribute Name: %s", name), - ) - } - } - - if diags.HasError() { - return NewCollationsValueUnknown(), diags - } - - collationNameAttribute, ok := attributes["collation_name"] - - if !ok { - diags.AddError( - "Attribute Missing", - `collation_name is missing from object`) - - return NewCollationsValueUnknown(), diags - } - - collationNameVal, ok := collationNameAttribute.(basetypes.StringValue) - - if !ok { - diags.AddError( - "Attribute Wrong Type", - fmt.Sprintf(`collation_name expected to be basetypes.StringValue, was: %T`, collationNameAttribute)) - } - - descriptionAttribute, ok := attributes["description"] - - if !ok { - diags.AddError( - "Attribute Missing", - `description is missing from object`) - - return NewCollationsValueUnknown(), diags - } - - descriptionVal, ok := descriptionAttribute.(basetypes.StringValue) - - if !ok { - diags.AddError( - "Attribute Wrong Type", - fmt.Sprintf(`description expected to be basetypes.StringValue, was: %T`, descriptionAttribute)) - } - - if diags.HasError() { - return NewCollationsValueUnknown(), diags - } - - return CollationsValue{ - CollationName: collationNameVal, - Description: descriptionVal, - state: attr.ValueStateKnown, - }, diags -} - -func NewCollationsValueMust(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) CollationsValue { - object, diags := NewCollationsValue(attributeTypes, attributes) - - if diags.HasError() { - // This could potentially be added to the diag package. - diagsStrings := make([]string, 0, len(diags)) - - for _, diagnostic := range diags { - diagsStrings = append(diagsStrings, fmt.Sprintf( - "%s | %s | %s", - diagnostic.Severity(), - diagnostic.Summary(), - diagnostic.Detail())) - } - - panic("NewCollationsValueMust received error(s): " + strings.Join(diagsStrings, "\n")) - } - - return object -} - -func (t CollationsType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error) { - if in.Type() == nil { - return NewCollationsValueNull(), nil - } - - if !in.Type().Equal(t.TerraformType(ctx)) { - return nil, fmt.Errorf("expected %s, got %s", t.TerraformType(ctx), in.Type()) - } - - if !in.IsKnown() { - return NewCollationsValueUnknown(), nil - } - - if in.IsNull() { - return NewCollationsValueNull(), nil - } - - attributes := map[string]attr.Value{} - - val := map[string]tftypes.Value{} - - err := in.As(&val) - - if err != nil { - return nil, err - } - - for k, v := range val { - a, err := t.AttrTypes[k].ValueFromTerraform(ctx, v) - - if err != nil { - return nil, err - } - - attributes[k] = a - } - - return NewCollationsValueMust(CollationsValue{}.AttributeTypes(ctx), attributes), nil -} - -func (t CollationsType) ValueType(ctx context.Context) attr.Value { - return CollationsValue{} -} - -var _ basetypes.ObjectValuable = CollationsValue{} - -type CollationsValue struct { - CollationName basetypes.StringValue `tfsdk:"collation_name"` - Description basetypes.StringValue `tfsdk:"description"` - state attr.ValueState -} - -func (v CollationsValue) ToTerraformValue(ctx context.Context) (tftypes.Value, error) { - attrTypes := make(map[string]tftypes.Type, 2) - - var val tftypes.Value - var err error - - attrTypes["collation_name"] = basetypes.StringType{}.TerraformType(ctx) - attrTypes["description"] = basetypes.StringType{}.TerraformType(ctx) - - objectType := tftypes.Object{AttributeTypes: attrTypes} - - switch v.state { - case attr.ValueStateKnown: - vals := make(map[string]tftypes.Value, 2) - - val, err = v.CollationName.ToTerraformValue(ctx) - - if err != nil { - return tftypes.NewValue(objectType, tftypes.UnknownValue), err - } - - vals["collation_name"] = val - - val, err = v.Description.ToTerraformValue(ctx) - - if err != nil { - return tftypes.NewValue(objectType, tftypes.UnknownValue), err - } - - vals["description"] = val - - if err := tftypes.ValidateValue(objectType, vals); err != nil { - return tftypes.NewValue(objectType, tftypes.UnknownValue), err - } - - return tftypes.NewValue(objectType, vals), nil - case attr.ValueStateNull: - return tftypes.NewValue(objectType, nil), nil - case attr.ValueStateUnknown: - return tftypes.NewValue(objectType, tftypes.UnknownValue), nil - default: - panic(fmt.Sprintf("unhandled Object state in ToTerraformValue: %s", v.state)) - } -} - -func (v CollationsValue) IsNull() bool { - return v.state == attr.ValueStateNull -} - -func (v CollationsValue) IsUnknown() bool { - return v.state == attr.ValueStateUnknown -} - -func (v CollationsValue) String() string { - return "CollationsValue" -} - -func (v CollationsValue) ToObjectValue(ctx context.Context) (basetypes.ObjectValue, diag.Diagnostics) { - var diags diag.Diagnostics - - attributeTypes := map[string]attr.Type{ - "collation_name": basetypes.StringType{}, - "description": basetypes.StringType{}, - } - - if v.IsNull() { - return types.ObjectNull(attributeTypes), diags - } - - if v.IsUnknown() { - return types.ObjectUnknown(attributeTypes), diags - } - - objVal, diags := types.ObjectValue( - attributeTypes, - map[string]attr.Value{ - "collation_name": v.CollationName, - "description": v.Description, - }) - - return objVal, diags -} - -func (v CollationsValue) Equal(o attr.Value) bool { - other, ok := o.(CollationsValue) - - if !ok { - return false - } - - if v.state != other.state { - return false - } - - if v.state != attr.ValueStateKnown { - return true - } - - if !v.CollationName.Equal(other.CollationName) { - return false - } - - if !v.Description.Equal(other.Description) { - return false - } - - return true -} - -func (v CollationsValue) Type(ctx context.Context) attr.Type { - return CollationsType{ - basetypes.ObjectType{ - AttrTypes: v.AttributeTypes(ctx), - }, - } -} - -func (v CollationsValue) AttributeTypes(ctx context.Context) map[string]attr.Type { - return map[string]attr.Type{ - "collation_name": basetypes.StringType{}, - "description": basetypes.StringType{}, - } -} diff --git a/stackit/internal/services/sqlserverflexalpha/sqlserverflex_acc_test.go.deactivated b/stackit/internal/services/sqlserverflexalpha/sqlserverflex_acc_test.go similarity index 100% rename from stackit/internal/services/sqlserverflexalpha/sqlserverflex_acc_test.go.deactivated rename to stackit/internal/services/sqlserverflexalpha/sqlserverflex_acc_test.go diff --git a/stackit/internal/services/sqlserverflexalpha/versions/datasources_gen/versions_data_source_gen.go b/stackit/internal/services/sqlserverflexalpha/versions/datasources_gen/version_data_source_gen.go similarity index 99% rename from stackit/internal/services/sqlserverflexalpha/versions/datasources_gen/versions_data_source_gen.go rename to stackit/internal/services/sqlserverflexalpha/versions/datasources_gen/version_data_source_gen.go index dc3dc150..cb9008f1 100644 --- a/stackit/internal/services/sqlserverflexalpha/versions/datasources_gen/versions_data_source_gen.go +++ b/stackit/internal/services/sqlserverflexalpha/versions/datasources_gen/version_data_source_gen.go @@ -17,7 +17,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/datasource/schema" ) -func VersionsDataSourceSchema(ctx context.Context) schema.Schema { +func VersionDataSourceSchema(ctx context.Context) schema.Schema { return schema.Schema{ Attributes: map[string]schema.Attribute{ "project_id": schema.StringAttribute{ @@ -26,7 +26,7 @@ func VersionsDataSourceSchema(ctx context.Context) schema.Schema { MarkdownDescription: "The STACKIT project ID.", }, "region": schema.StringAttribute{ - Optional: true, + Required: true, Description: "The region which should be addressed", MarkdownDescription: "The region which should be addressed", Validators: []validator.String{ @@ -73,7 +73,7 @@ func VersionsDataSourceSchema(ctx context.Context) schema.Schema { } } -type VersionsModel struct { +type VersionModel struct { ProjectId types.String `tfsdk:"project_id"` Region types.String `tfsdk:"region"` Versions types.List `tfsdk:"versions"` diff --git a/stackit/internal/services/sqlserverflexbeta/collations/datasources_gen/collations_data_source_gen.go b/stackit/internal/services/sqlserverflexbeta/collations/datasources_gen/collations_data_source_gen.go deleted file mode 100644 index 7ed20e4d..00000000 --- a/stackit/internal/services/sqlserverflexbeta/collations/datasources_gen/collations_data_source_gen.go +++ /dev/null @@ -1,452 +0,0 @@ -// Code generated by terraform-plugin-framework-generator DO NOT EDIT. - -package sqlserverflexbeta - -import ( - "context" - "fmt" - "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" - "github.com/hashicorp/terraform-plugin-framework/attr" - "github.com/hashicorp/terraform-plugin-framework/diag" - "github.com/hashicorp/terraform-plugin-framework/schema/validator" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" - "github.com/hashicorp/terraform-plugin-go/tftypes" - "strings" - - "github.com/hashicorp/terraform-plugin-framework/datasource/schema" -) - -func CollationsDataSourceSchema(ctx context.Context) schema.Schema { - return schema.Schema{ - Attributes: map[string]schema.Attribute{ - "collations": schema.ListNestedAttribute{ - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "collation_name": schema.StringAttribute{ - Computed: true, - }, - "description": schema.StringAttribute{ - Computed: true, - }, - }, - CustomType: CollationsType{ - ObjectType: types.ObjectType{ - AttrTypes: CollationsValue{}.AttributeTypes(ctx), - }, - }, - }, - Computed: true, - Description: "List of collations available for the instance.", - MarkdownDescription: "List of collations available for the instance.", - }, - "instance_id": schema.StringAttribute{ - Required: true, - Description: "The ID of the instance.", - MarkdownDescription: "The ID of the instance.", - }, - "project_id": schema.StringAttribute{ - Required: true, - Description: "The STACKIT project ID.", - MarkdownDescription: "The STACKIT project ID.", - }, - "region": schema.StringAttribute{ - Optional: true, - Description: "The region which should be addressed", - MarkdownDescription: "The region which should be addressed", - Validators: []validator.String{ - stringvalidator.OneOf( - "eu01", - "eu02", - ), - }, - }, - }, - } -} - -type CollationsModel struct { - Collations types.List `tfsdk:"collations"` - InstanceId types.String `tfsdk:"instance_id"` - ProjectId types.String `tfsdk:"project_id"` - Region types.String `tfsdk:"region"` -} - -var _ basetypes.ObjectTypable = CollationsType{} - -type CollationsType struct { - basetypes.ObjectType -} - -func (t CollationsType) Equal(o attr.Type) bool { - other, ok := o.(CollationsType) - - if !ok { - return false - } - - return t.ObjectType.Equal(other.ObjectType) -} - -func (t CollationsType) String() string { - return "CollationsType" -} - -func (t CollationsType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { - var diags diag.Diagnostics - - attributes := in.Attributes() - - collationNameAttribute, ok := attributes["collation_name"] - - if !ok { - diags.AddError( - "Attribute Missing", - `collation_name is missing from object`) - - return nil, diags - } - - collationNameVal, ok := collationNameAttribute.(basetypes.StringValue) - - if !ok { - diags.AddError( - "Attribute Wrong Type", - fmt.Sprintf(`collation_name expected to be basetypes.StringValue, was: %T`, collationNameAttribute)) - } - - descriptionAttribute, ok := attributes["description"] - - if !ok { - diags.AddError( - "Attribute Missing", - `description is missing from object`) - - return nil, diags - } - - descriptionVal, ok := descriptionAttribute.(basetypes.StringValue) - - if !ok { - diags.AddError( - "Attribute Wrong Type", - fmt.Sprintf(`description expected to be basetypes.StringValue, was: %T`, descriptionAttribute)) - } - - if diags.HasError() { - return nil, diags - } - - return CollationsValue{ - CollationName: collationNameVal, - Description: descriptionVal, - state: attr.ValueStateKnown, - }, diags -} - -func NewCollationsValueNull() CollationsValue { - return CollationsValue{ - state: attr.ValueStateNull, - } -} - -func NewCollationsValueUnknown() CollationsValue { - return CollationsValue{ - state: attr.ValueStateUnknown, - } -} - -func NewCollationsValue(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) (CollationsValue, diag.Diagnostics) { - var diags diag.Diagnostics - - // Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/521 - ctx := context.Background() - - for name, attributeType := range attributeTypes { - attribute, ok := attributes[name] - - if !ok { - diags.AddError( - "Missing CollationsValue Attribute Value", - "While creating a CollationsValue value, a missing attribute value was detected. "+ - "A CollationsValue must contain values for all attributes, even if null or unknown. "+ - "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ - fmt.Sprintf("CollationsValue Attribute Name (%s) Expected Type: %s", name, attributeType.String()), - ) - - continue - } - - if !attributeType.Equal(attribute.Type(ctx)) { - diags.AddError( - "Invalid CollationsValue Attribute Type", - "While creating a CollationsValue value, an invalid attribute value was detected. "+ - "A CollationsValue must use a matching attribute type for the value. "+ - "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ - fmt.Sprintf("CollationsValue Attribute Name (%s) Expected Type: %s\n", name, attributeType.String())+ - fmt.Sprintf("CollationsValue Attribute Name (%s) Given Type: %s", name, attribute.Type(ctx)), - ) - } - } - - for name := range attributes { - _, ok := attributeTypes[name] - - if !ok { - diags.AddError( - "Extra CollationsValue Attribute Value", - "While creating a CollationsValue value, an extra attribute value was detected. "+ - "A CollationsValue must not contain values beyond the expected attribute types. "+ - "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ - fmt.Sprintf("Extra CollationsValue Attribute Name: %s", name), - ) - } - } - - if diags.HasError() { - return NewCollationsValueUnknown(), diags - } - - collationNameAttribute, ok := attributes["collation_name"] - - if !ok { - diags.AddError( - "Attribute Missing", - `collation_name is missing from object`) - - return NewCollationsValueUnknown(), diags - } - - collationNameVal, ok := collationNameAttribute.(basetypes.StringValue) - - if !ok { - diags.AddError( - "Attribute Wrong Type", - fmt.Sprintf(`collation_name expected to be basetypes.StringValue, was: %T`, collationNameAttribute)) - } - - descriptionAttribute, ok := attributes["description"] - - if !ok { - diags.AddError( - "Attribute Missing", - `description is missing from object`) - - return NewCollationsValueUnknown(), diags - } - - descriptionVal, ok := descriptionAttribute.(basetypes.StringValue) - - if !ok { - diags.AddError( - "Attribute Wrong Type", - fmt.Sprintf(`description expected to be basetypes.StringValue, was: %T`, descriptionAttribute)) - } - - if diags.HasError() { - return NewCollationsValueUnknown(), diags - } - - return CollationsValue{ - CollationName: collationNameVal, - Description: descriptionVal, - state: attr.ValueStateKnown, - }, diags -} - -func NewCollationsValueMust(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) CollationsValue { - object, diags := NewCollationsValue(attributeTypes, attributes) - - if diags.HasError() { - // This could potentially be added to the diag package. - diagsStrings := make([]string, 0, len(diags)) - - for _, diagnostic := range diags { - diagsStrings = append(diagsStrings, fmt.Sprintf( - "%s | %s | %s", - diagnostic.Severity(), - diagnostic.Summary(), - diagnostic.Detail())) - } - - panic("NewCollationsValueMust received error(s): " + strings.Join(diagsStrings, "\n")) - } - - return object -} - -func (t CollationsType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error) { - if in.Type() == nil { - return NewCollationsValueNull(), nil - } - - if !in.Type().Equal(t.TerraformType(ctx)) { - return nil, fmt.Errorf("expected %s, got %s", t.TerraformType(ctx), in.Type()) - } - - if !in.IsKnown() { - return NewCollationsValueUnknown(), nil - } - - if in.IsNull() { - return NewCollationsValueNull(), nil - } - - attributes := map[string]attr.Value{} - - val := map[string]tftypes.Value{} - - err := in.As(&val) - - if err != nil { - return nil, err - } - - for k, v := range val { - a, err := t.AttrTypes[k].ValueFromTerraform(ctx, v) - - if err != nil { - return nil, err - } - - attributes[k] = a - } - - return NewCollationsValueMust(CollationsValue{}.AttributeTypes(ctx), attributes), nil -} - -func (t CollationsType) ValueType(ctx context.Context) attr.Value { - return CollationsValue{} -} - -var _ basetypes.ObjectValuable = CollationsValue{} - -type CollationsValue struct { - CollationName basetypes.StringValue `tfsdk:"collation_name"` - Description basetypes.StringValue `tfsdk:"description"` - state attr.ValueState -} - -func (v CollationsValue) ToTerraformValue(ctx context.Context) (tftypes.Value, error) { - attrTypes := make(map[string]tftypes.Type, 2) - - var val tftypes.Value - var err error - - attrTypes["collation_name"] = basetypes.StringType{}.TerraformType(ctx) - attrTypes["description"] = basetypes.StringType{}.TerraformType(ctx) - - objectType := tftypes.Object{AttributeTypes: attrTypes} - - switch v.state { - case attr.ValueStateKnown: - vals := make(map[string]tftypes.Value, 2) - - val, err = v.CollationName.ToTerraformValue(ctx) - - if err != nil { - return tftypes.NewValue(objectType, tftypes.UnknownValue), err - } - - vals["collation_name"] = val - - val, err = v.Description.ToTerraformValue(ctx) - - if err != nil { - return tftypes.NewValue(objectType, tftypes.UnknownValue), err - } - - vals["description"] = val - - if err := tftypes.ValidateValue(objectType, vals); err != nil { - return tftypes.NewValue(objectType, tftypes.UnknownValue), err - } - - return tftypes.NewValue(objectType, vals), nil - case attr.ValueStateNull: - return tftypes.NewValue(objectType, nil), nil - case attr.ValueStateUnknown: - return tftypes.NewValue(objectType, tftypes.UnknownValue), nil - default: - panic(fmt.Sprintf("unhandled Object state in ToTerraformValue: %s", v.state)) - } -} - -func (v CollationsValue) IsNull() bool { - return v.state == attr.ValueStateNull -} - -func (v CollationsValue) IsUnknown() bool { - return v.state == attr.ValueStateUnknown -} - -func (v CollationsValue) String() string { - return "CollationsValue" -} - -func (v CollationsValue) ToObjectValue(ctx context.Context) (basetypes.ObjectValue, diag.Diagnostics) { - var diags diag.Diagnostics - - attributeTypes := map[string]attr.Type{ - "collation_name": basetypes.StringType{}, - "description": basetypes.StringType{}, - } - - if v.IsNull() { - return types.ObjectNull(attributeTypes), diags - } - - if v.IsUnknown() { - return types.ObjectUnknown(attributeTypes), diags - } - - objVal, diags := types.ObjectValue( - attributeTypes, - map[string]attr.Value{ - "collation_name": v.CollationName, - "description": v.Description, - }) - - return objVal, diags -} - -func (v CollationsValue) Equal(o attr.Value) bool { - other, ok := o.(CollationsValue) - - if !ok { - return false - } - - if v.state != other.state { - return false - } - - if v.state != attr.ValueStateKnown { - return true - } - - if !v.CollationName.Equal(other.CollationName) { - return false - } - - if !v.Description.Equal(other.Description) { - return false - } - - return true -} - -func (v CollationsValue) Type(ctx context.Context) attr.Type { - return CollationsType{ - basetypes.ObjectType{ - AttrTypes: v.AttributeTypes(ctx), - }, - } -} - -func (v CollationsValue) AttributeTypes(ctx context.Context) map[string]attr.Type { - return map[string]attr.Type{ - "collation_name": basetypes.StringType{}, - "description": basetypes.StringType{}, - } -} diff --git a/stackit/internal/services/sqlserverflexbeta/instance/flavor_functions.go b/stackit/internal/services/sqlserverflexbeta/instance/flavor_functions.go deleted file mode 100644 index 7b856dbf..00000000 --- a/stackit/internal/services/sqlserverflexbeta/instance/flavor_functions.go +++ /dev/null @@ -1,65 +0,0 @@ -package sqlserverflexbeta - -import ( - "context" - "fmt" - - "github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex/v3beta1api" -) - -type flavorsClientReader interface { - GetFlavorsRequest( - ctx context.Context, - projectId, region string, - ) v3beta1api.ApiGetFlavorsRequestRequest -} - -func getAllFlavors(ctx context.Context, client flavorsClientReader, projectId, region string) ( - []v3beta1api.ListFlavors, - error, -) { - getAllFilter := func(_ v3beta1api.ListFlavors) bool { return true } - flavorList, err := getFlavorsByFilter(ctx, client, projectId, region, getAllFilter) - if err != nil { - return nil, err - } - return flavorList, nil -} - -// getFlavorsByFilter is a helper function to retrieve flavors using a filtern function. -// Hint: The API does not have a GetFlavors endpoint, only ListFlavors -func getFlavorsByFilter( - ctx context.Context, - client flavorsClientReader, - projectId, region string, - filter func(db v3beta1api.ListFlavors) bool, -) ([]v3beta1api.ListFlavors, error) { - if projectId == "" || region == "" { - return nil, fmt.Errorf("listing v3beta1api flavors: projectId and region are required") - } - - const pageSize = 25 - - var result = make([]v3beta1api.ListFlavors, 0) - - for page := int64(1); ; page++ { - res, err := client.GetFlavorsRequest(ctx, projectId, region). - Page(page).Size(pageSize).Sort(v3beta1api.FLAVORSORT_INDEX_ASC).Execute() - if err != nil { - return nil, fmt.Errorf("requesting flavors list (page %d): %w", page, err) - } - - // If the API returns no flavors, we have reached the end of the list. - if len(res.Flavors) == 0 { - break - } - - for _, flavor := range res.Flavors { - if filter(flavor) { - result = append(result, flavor) - } - } - } - - return result, nil -} diff --git a/stackit/internal/services/sqlserverflexbeta/instance/functions.go b/stackit/internal/services/sqlserverflexbeta/instance/functions.go index 1674e0e0..b079d741 100644 --- a/stackit/internal/services/sqlserverflexbeta/instance/functions.go +++ b/stackit/internal/services/sqlserverflexbeta/instance/functions.go @@ -22,7 +22,7 @@ import ( func mapResponseToModel( ctx context.Context, resp *v3beta1api.GetInstanceResponse, - m *LocalInstanceModel, + m *sqlserverflexbetaResGen.InstanceModel, tfDiags diag.Diagnostics, ) error { m.BackupSchedule = types.StringValue(resp.GetBackupSchedule()) @@ -133,7 +133,7 @@ func mapDataResponseToModel( func handleEncryption( ctx context.Context, - m *LocalInstanceModel, + m *sqlserverflexbetaResGen.InstanceModel, resp *v3beta1api.GetInstanceResponse, ) sqlserverflexbetaResGen.EncryptionValue { if !resp.HasEncryption() || @@ -191,7 +191,7 @@ func handleDSEncryption( func toCreatePayload( ctx context.Context, - model *LocalInstanceModel, + model *sqlserverflexbetaResGen.InstanceModel, ) (*v3beta1api.CreateInstanceRequestPayload, error) { if model == nil { return nil, fmt.Errorf("nil model") @@ -241,7 +241,7 @@ func toCreatePayload( func toUpdatePayload( ctx context.Context, - m *LocalInstanceModel, + m *sqlserverflexbetaResGen.InstanceModel, resp *resource.UpdateResponse, ) (*v3beta1api.UpdateInstanceRequestPayload, error) { if m == nil { diff --git a/stackit/internal/services/sqlserverflexbeta/instance/functions_test.go b/stackit/internal/services/sqlserverflexbeta/instance/functions_test.go index 06477209..03380d5d 100644 --- a/stackit/internal/services/sqlserverflexbeta/instance/functions_test.go +++ b/stackit/internal/services/sqlserverflexbeta/instance/functions_test.go @@ -40,7 +40,7 @@ func Test_handleDSEncryption(t *testing.T) { func Test_handleEncryption(t *testing.T) { type args struct { - m *LocalInstanceModel + m *sqlserverflexbetaRs.InstanceModel resp *sqlserverflexbetaPkgGen.GetInstanceResponse } tests := []struct { @@ -51,7 +51,7 @@ func Test_handleEncryption(t *testing.T) { { name: "nil response", args: args{ - m: &LocalInstanceModel{}, + m: &sqlserverflexbetaRs.InstanceModel{}, resp: &sqlserverflexbetaPkgGen.GetInstanceResponse{}, }, want: sqlserverflexbetaRs.EncryptionValue{}, @@ -59,7 +59,7 @@ func Test_handleEncryption(t *testing.T) { { name: "nil response", args: args{ - m: &LocalInstanceModel{}, + m: &sqlserverflexbetaRs.InstanceModel{}, resp: &sqlserverflexbetaPkgGen.GetInstanceResponse{ Encryption: &sqlserverflexbetaPkgGen.InstanceEncryption{}, }, @@ -69,7 +69,7 @@ func Test_handleEncryption(t *testing.T) { { name: "response with values", args: args{ - m: &LocalInstanceModel{}, + m: &sqlserverflexbetaRs.InstanceModel{}, resp: &sqlserverflexbetaPkgGen.GetInstanceResponse{ Encryption: &sqlserverflexbetaPkgGen.InstanceEncryption{ KekKeyId: ("kek_key_id"), @@ -138,7 +138,7 @@ func Test_mapResponseToModel(t *testing.T) { type args struct { ctx context.Context resp *sqlserverflexbetaPkgGen.GetInstanceResponse - m *LocalInstanceModel + m *sqlserverflexbetaRs.InstanceModel tfDiags diag.Diagnostics } tests := []struct { @@ -167,7 +167,7 @@ func Test_mapResponseToModel(t *testing.T) { func Test_toCreatePayload(t *testing.T) { type args struct { ctx context.Context - model *LocalInstanceModel + model *sqlserverflexbetaRs.InstanceModel } tests := []struct { name string @@ -175,61 +175,61 @@ func Test_toCreatePayload(t *testing.T) { want *sqlserverflexbetaPkgGen.CreateInstanceRequestPayload wantErr bool }{ - //{ - // name: "simple", - // args: args{ - // ctx: context.Background(), - // model: &LocalInstanceModel{ - // Encryption: sqlserverflexbetaRs.NewEncryptionValueMust( - // sqlserverflexbetaRs.EncryptionValue{}.AttributeTypes(context.Background()), - // map[string]attr.Value{ - // "kek_key_id": types.StringValue("kek_key_id"), - // "kek_key_ring_id": types.StringValue("kek_key_ring_id"), - // "kek_key_version": types.StringValue("kek_key_version"), - // "service_account": types.StringValue("sacc"), - // }, - // ), - // Storage: sqlserverflexbetaRs.StorageValue{}, - // }, - // }, - // want: &sqlserverflexbetaPkgGen.CreateInstanceRequestPayload{ - // BackupSchedule: "", - // Encryption: &sqlserverflexbetaPkgGen.InstanceEncryption{ - // KekKeyId: ("kek_key_id"), - // KekKeyRingId: ("kek_key_ring_id"), - // KekKeyVersion: ("kek_key_version"), - // ServiceAccount: ("sacc"), - // }, - // FlavorId: "", - // Name: "", - // Network: sqlserverflexbetaPkgGen.CreateInstanceRequestPayloadNetwork{}, - // RetentionDays: 0, - // Storage: sqlserverflexbetaPkgGen.StorageCreate{}, - // Version: "", - // }, - // wantErr: false, - //}, - //{ - // name: "nil object", - // args: args{ - // ctx: context.Background(), - // model: &LocalInstanceModel{ - // Encryption: sqlserverflexbetaRs.NewEncryptionValueNull(), - // Storage: sqlserverflexbetaRs.StorageValue{}, - // }, - // }, - // want: &sqlserverflexbetaPkgGen.CreateInstanceRequestPayload{ - // BackupSchedule: "", - // Encryption: nil, - // FlavorId: "", - // Name: "", - // Network: sqlserverflexbetaPkgGen.CreateInstanceRequestPayloadNetwork{}, - // RetentionDays: 0, - // Storage: sqlserverflexbetaPkgGen.StorageCreate{}, - // Version: "", - // }, - // wantErr: false, - //}, + { + name: "simple", + args: args{ + ctx: context.Background(), + model: &sqlserverflexbetaRs.InstanceModel{ + Encryption: sqlserverflexbetaRs.NewEncryptionValueMust( + sqlserverflexbetaRs.EncryptionValue{}.AttributeTypes(context.Background()), + map[string]attr.Value{ + "kek_key_id": types.StringValue("kek_key_id"), + "kek_key_ring_id": types.StringValue("kek_key_ring_id"), + "kek_key_version": types.StringValue("kek_key_version"), + "service_account": types.StringValue("sacc"), + }, + ), + Storage: sqlserverflexbetaRs.StorageValue{}, + }, + }, + want: &sqlserverflexbetaPkgGen.CreateInstanceRequestPayload{ + BackupSchedule: "", + Encryption: &sqlserverflexbetaPkgGen.InstanceEncryption{ + KekKeyId: ("kek_key_id"), + KekKeyRingId: ("kek_key_ring_id"), + KekKeyVersion: ("kek_key_version"), + ServiceAccount: ("sacc"), + }, + FlavorId: "", + Name: "", + Network: sqlserverflexbetaPkgGen.CreateInstanceRequestPayloadNetwork{}, + RetentionDays: 0, + Storage: sqlserverflexbetaPkgGen.StorageCreate{}, + Version: "", + }, + wantErr: false, + }, + { + name: "nil object", + args: args{ + ctx: context.Background(), + model: &sqlserverflexbetaRs.InstanceModel{ + Encryption: sqlserverflexbetaRs.NewEncryptionValueNull(), + Storage: sqlserverflexbetaRs.StorageValue{}, + }, + }, + want: &sqlserverflexbetaPkgGen.CreateInstanceRequestPayload{ + BackupSchedule: "", + Encryption: nil, + FlavorId: "", + Name: "", + Network: sqlserverflexbetaPkgGen.CreateInstanceRequestPayloadNetwork{}, + RetentionDays: 0, + Storage: sqlserverflexbetaPkgGen.StorageCreate{}, + Version: "", + }, + wantErr: false, + }, } for _, tt := range tests { t.Run( @@ -250,7 +250,7 @@ func Test_toCreatePayload(t *testing.T) { func Test_toUpdatePayload(t *testing.T) { type args struct { ctx context.Context - m *LocalInstanceModel + m *sqlserverflexbetaRs.InstanceModel resp *resource.UpdateResponse } tests := []struct { diff --git a/stackit/internal/services/sqlserverflexbeta/instance/resource.go b/stackit/internal/services/sqlserverflexbeta/instance/resource.go index e61091cf..bb7e67b4 100644 --- a/stackit/internal/services/sqlserverflexbeta/instance/resource.go +++ b/stackit/internal/services/sqlserverflexbeta/instance/resource.go @@ -10,10 +10,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" "github.com/hashicorp/terraform-plugin-log/tflog" "github.com/stackitcloud/stackit-sdk-go/core/config" "github.com/stackitcloud/stackit-sdk-go/core/oapierror" @@ -45,19 +42,8 @@ type instanceResource struct { providerData core.ProviderData } -// LocalInstanceModel describes the resource data model. -type LocalInstanceModel struct { - sqlserverflexbetaResGen.InstanceModel - Flavor types.Object `tfsdk:"flavor"` -} - -// LocalFlavorModel Struct corresponding to Model.Flavor -type LocalFlavorModel struct { - Id types.String `tfsdk:"id"` - Description types.String `tfsdk:"description"` - CPU types.Int64 `tfsdk:"cpu"` - RAM types.Int64 `tfsdk:"ram"` -} +// resourceModel describes the resource data model. +type resourceModel = sqlserverflexbetaResGen.InstanceModel func (r *instanceResource) Metadata( _ context.Context, @@ -70,40 +56,8 @@ func (r *instanceResource) Metadata( //go:embed planModifiers.yaml var modifiersFileByte []byte -func (r *instanceResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { +func (r *instanceResource) Schema(ctx context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) { s := sqlserverflexbetaResGen.InstanceResourceSchema(ctx) - s.Attributes["flavor"] = schema.SingleNestedAttribute{ - Optional: true, - DeprecationMessage: "Please use flavor_id instead.", - Attributes: map[string]schema.Attribute{ - "id": schema.StringAttribute{ - Computed: true, - PlanModifiers: []planmodifier.String{ - UseStateForUnknownIfFlavorUnchanged(req), - }, - }, - "description": schema.StringAttribute{ - Computed: true, - PlanModifiers: []planmodifier.String{ - UseStateForUnknownIfFlavorUnchanged(req), - }, - }, - "cpu": schema.Int64Attribute{ - DeprecationMessage: "Please use flavor_id instead.", - Optional: true, - }, - "ram": schema.Int64Attribute{ - DeprecationMessage: "Please use flavor_id instead.", - Optional: true, - }, - }, - } - - s.Attributes["flavor_id"] = schema.StringAttribute{ - Optional: true, - Description: "The id of the instance flavor.", - MarkdownDescription: "The id of the instance flavor.", - } fields, err := utils.ReadModifiersConfig(modifiersFileByte) if err != nil { @@ -169,7 +123,7 @@ func (r *instanceResource) ModifyPlan( if req.Config.Raw.IsNull() { return } - var configModel LocalInstanceModel + var configModel resourceModel resp.Diagnostics.Append(req.Config.Get(ctx, &configModel)...) if resp.Diagnostics.HasError() { return @@ -178,7 +132,7 @@ func (r *instanceResource) ModifyPlan( if req.Plan.Raw.IsNull() { return } - var planModel LocalInstanceModel + var planModel resourceModel resp.Diagnostics.Append(req.Plan.Get(ctx, &planModel)...) if resp.Diagnostics.HasError() { return @@ -196,7 +150,7 @@ func (r *instanceResource) ModifyPlan( } func (r *instanceResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var data LocalInstanceModel + var data resourceModel crateErr := "[SQL Server Flex BETA - Create] error" // Read Terraform plan data into the model @@ -213,73 +167,6 @@ func (r *instanceResource) Create(ctx context.Context, req resource.CreateReques ctx = tflog.SetField(ctx, "project_id", projectID) ctx = tflog.SetField(ctx, "region", region) - // determine flavor ID - var flModel = &LocalFlavorModel{} - if !(data.Flavor.IsNull() || data.Flavor.IsUnknown()) { - diags := data.Flavor.As(ctx, flModel, basetypes.ObjectAsOptions{}) - resp.Diagnostics.Append(diags...) - if resp.Diagnostics.HasError() { - return - } - - flavors, err := getAllFlavors(ctx, r.client.DefaultAPI, projectID, region) - if err != nil { - core.LogAndAddError(ctx, &resp.Diagnostics, "Error reading flavors", fmt.Sprintf("getAllFlavors: %v", err)) - return - } - tflog.Debug(ctx, fmt.Sprintf("loaded flavors: %d", len(flavors))) - - var foundFlavors []v3beta1api.ListFlavors - for _, flavor := range flavors { - if flModel.CPU.ValueInt64() != int64(flavor.Cpu) { - // tflog.Debug(ctx, fmt.Sprintf("flavor - cpu did not match (%d - %d)", flModel.CPU.ValueInt64(), flavor.Cpu)) - continue - } - if flModel.RAM.ValueInt64() != int64(flavor.Memory) { - // tflog.Debug(ctx, fmt.Sprintf("flavor - ram did not match (%d - %d)", flModel.RAM.ValueInt64(), flavor.Memory)) - continue - } - tmpNodeType := "Single" - if data.Replicas.ValueInt64() > 1 { - tmpNodeType = "Replica" - } - if strings.ToLower(tmpNodeType) != strings.ToLower(flavor.NodeType) { - //tflog.Debug( - // ctx, - // fmt.Sprintf( - // "flavor - nodeType did not match ('%s' - '%s')", - // strings.ToLower(tmpNodeType), - // strings.ToLower(flavor.NodeType), - // ), - //) - continue - } - tflog.Debug(ctx, fmt.Sprintf("found flavor %s, checking storage classes", flavor.Id)) - for _, sc := range flavor.StorageClasses { - if data.Storage.Class.ValueString() != sc.Class { - continue - } - tflog.Debug(ctx, fmt.Sprintf("found storage class '%s' for flavor '%s', checking storage classes", sc.Class, flavor.Id)) - foundFlavors = append(foundFlavors, flavor) - } - } - if len(foundFlavors) == 0 { - resp.Diagnostics.AddError("get flavor", "could not find requested flavor") - return - } - if len(foundFlavors) > 1 { - resp.Diagnostics.AddError("get flavor", "found too many matching flavors") - return - } - - f := foundFlavors[0] - flModel.Description = types.StringValue(f.Description) - flModel.Id = utils.BuildInternalTerraformId(data.ProjectId.ValueString(), region, f.Id) - data.FlavorId = types.StringValue(f.Id) - //flModel. .MaxGb = types.Int32Value(f.MaxGB) - //flModel.MinGb = types.Int32Value(f.MinGB) - } - // Generate API request body from model payload, err := toCreatePayload(ctx, &data) if err != nil { @@ -369,7 +256,7 @@ func (r *instanceResource) Create(ctx context.Context, req resource.CreateReques } func (r *instanceResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - var data LocalInstanceModel + var data resourceModel // Read Terraform prior state data into the model resp.Diagnostics.Append(req.State.Get(ctx, &data)...) @@ -422,7 +309,7 @@ func (r *instanceResource) Read(ctx context.Context, req resource.ReadRequest, r } func (r *instanceResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - var data LocalInstanceModel + var data resourceModel updateInstanceError := "Error updating instance" resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) @@ -502,7 +389,7 @@ func (r *instanceResource) Update(ctx context.Context, req resource.UpdateReques } func (r *instanceResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - var data LocalInstanceModel + var data resourceModel // Read Terraform prior state data into the model resp.Diagnostics.Append(req.State.Get(ctx, &data)...) diff --git a/stackit/internal/services/sqlserverflexbeta/instance/use_state_for_unknown_if_flavor_unchanged_modifier.go b/stackit/internal/services/sqlserverflexbeta/instance/use_state_for_unknown_if_flavor_unchanged_modifier.go deleted file mode 100644 index c944f921..00000000 --- a/stackit/internal/services/sqlserverflexbeta/instance/use_state_for_unknown_if_flavor_unchanged_modifier.go +++ /dev/null @@ -1,85 +0,0 @@ -package sqlserverflexbeta - -import ( - "context" - - "github.com/hashicorp/terraform-plugin-framework/resource" - "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" -) - -type useStateForUnknownIfFlavorUnchangedModifier struct { - Req resource.SchemaRequest -} - -// UseStateForUnknownIfFlavorUnchanged returns a plan modifier similar to UseStateForUnknown -// if the RAM and CPU values are not changed in the plan. Otherwise, the plan modifier does nothing. -func UseStateForUnknownIfFlavorUnchanged(req resource.SchemaRequest) planmodifier.String { - return useStateForUnknownIfFlavorUnchangedModifier{ - Req: req, - } -} - -func (m useStateForUnknownIfFlavorUnchangedModifier) Description(context.Context) string { - return "UseStateForUnknownIfFlavorUnchanged returns a plan modifier similar to UseStateForUnknown if the RAM and CPU values are not changed in the plan. Otherwise, the plan modifier does nothing." -} - -func (m useStateForUnknownIfFlavorUnchangedModifier) MarkdownDescription(ctx context.Context) string { - return m.Description(ctx) -} - -func (m useStateForUnknownIfFlavorUnchangedModifier) PlanModifyString(ctx context.Context, req planmodifier.StringRequest, resp *planmodifier.StringResponse) { // nolint:gocritic // function signature required by Terraform - // Do nothing if there is no state value. - if req.StateValue.IsNull() { - return - } - - // Do nothing if there is a known planned value. - if !req.PlanValue.IsUnknown() { - return - } - - // Do nothing if there is an unknown configuration value, otherwise interpolation gets messed up. - if req.ConfigValue.IsUnknown() { - return - } - - // The above checks are taken from the UseStateForUnknown plan modifier implementation - // (https://github.com/hashicorp/terraform-plugin-framework/blob/main/resource/schema/stringplanmodifier/use_state_for_unknown.go#L38) - - var stateModel LocalInstanceModel - diags := req.State.Get(ctx, &stateModel) - resp.Diagnostics.Append(diags...) - if resp.Diagnostics.HasError() { - return - } - - var stateFlavor = &LocalFlavorModel{} - if !(stateModel.Flavor.IsNull() || stateModel.Flavor.IsUnknown()) { - diags = stateModel.Flavor.As(ctx, stateFlavor, basetypes.ObjectAsOptions{}) - resp.Diagnostics.Append(diags...) - if resp.Diagnostics.HasError() { - return - } - } - - var planModel LocalInstanceModel - diags = req.Plan.Get(ctx, &planModel) - resp.Diagnostics.Append(diags...) - if resp.Diagnostics.HasError() { - return - } - - var planFlavor = &LocalFlavorModel{} - if !(planModel.Flavor.IsNull() || planModel.Flavor.IsUnknown()) { - diags = planModel.Flavor.As(ctx, planFlavor, basetypes.ObjectAsOptions{}) - resp.Diagnostics.Append(diags...) - if resp.Diagnostics.HasError() { - return - } - } - - if planFlavor.CPU == stateFlavor.CPU && planFlavor.RAM == stateFlavor.RAM { - resp.PlanValue = req.StateValue - } -} diff --git a/stackit/internal/services/sqlserverflexbeta/versions/datasources_gen/versions_data_source_gen.go b/stackit/internal/services/sqlserverflexbeta/versions/datasources_gen/version_data_source_gen.go similarity index 99% rename from stackit/internal/services/sqlserverflexbeta/versions/datasources_gen/versions_data_source_gen.go rename to stackit/internal/services/sqlserverflexbeta/versions/datasources_gen/version_data_source_gen.go index c4f33642..dfeb5348 100644 --- a/stackit/internal/services/sqlserverflexbeta/versions/datasources_gen/versions_data_source_gen.go +++ b/stackit/internal/services/sqlserverflexbeta/versions/datasources_gen/version_data_source_gen.go @@ -17,7 +17,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/datasource/schema" ) -func VersionsDataSourceSchema(ctx context.Context) schema.Schema { +func VersionDataSourceSchema(ctx context.Context) schema.Schema { return schema.Schema{ Attributes: map[string]schema.Attribute{ "project_id": schema.StringAttribute{ @@ -26,7 +26,7 @@ func VersionsDataSourceSchema(ctx context.Context) schema.Schema { MarkdownDescription: "The STACKIT project ID.", }, "region": schema.StringAttribute{ - Optional: true, + Required: true, Description: "The region which should be addressed", MarkdownDescription: "The region which should be addressed", Validators: []validator.String{ @@ -74,7 +74,7 @@ func VersionsDataSourceSchema(ctx context.Context) schema.Schema { } } -type VersionsModel struct { +type VersionModel struct { ProjectId types.String `tfsdk:"project_id"` Region types.String `tfsdk:"region"` Versions types.List `tfsdk:"versions"` diff --git a/stackit/internal/wait/postgresflexalpha/wait.go b/stackit/internal/wait/postgresflexalpha/wait.go index 6b1f250a..930fe501 100644 --- a/stackit/internal/wait/postgresflexalpha/wait.go +++ b/stackit/internal/wait/postgresflexalpha/wait.go @@ -61,7 +61,7 @@ func CreateInstanceWaitHandler( maxWait := time.Minute * 90 startTime := time.Now() extendedTimeout := 0 - maxFailedCount := 10 + maxFailedCount := 3 failedCount := 0 handler := wait.New( @@ -129,7 +129,7 @@ func CreateInstanceWaitHandler( }, ) var waitCounter int64 = 1 - maxWaitInt := big.NewInt(10) + maxWaitInt := big.NewInt(7) n, randErr := rand.Int(rand.Reader, maxWaitInt) if randErr == nil { waitCounter = n.Int64() + 1 diff --git a/stackit/provider.go b/stackit/provider.go index 0cda837a..62990050 100644 --- a/stackit/provider.go +++ b/stackit/provider.go @@ -19,11 +19,11 @@ import ( "github.com/hashicorp/terraform-plugin-log/tflog" sdkauth "github.com/stackitcloud/stackit-sdk-go/core/auth" "github.com/stackitcloud/stackit-sdk-go/core/config" - sqlserverFlexBetaFlavor "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexbeta/flavor" - //sqlserverflexalphaDatabase "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexalpha/database" - //sqlserverflexalphaInstance "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexalpha/instance" - //sqlserverflexalphaUser "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexalpha/user" + sqlserverflexalphaDatabase "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexalpha/database" + sqlserverflexalphaInstance "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexalpha/instance" + sqlserverflexalphaUser "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexalpha/user" + sqlserverflexbetaUser "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexbeta/user" "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/core" "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/features" @@ -36,7 +36,7 @@ import ( sqlserverFlexBetaDatabase "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexbeta/database" sqlserverflexBetaInstance "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexbeta/instance" - sqlserverflexbetaUser "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexbeta/user" + // sqlserverFlexBetaUser "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexbetaUser/user" ) // Ensure the implementation satisfies the expected interfaces @@ -536,14 +536,14 @@ func (p *Provider) DataSources(_ context.Context) []func() datasource.DataSource postgresflexalphaFlavors.NewFlavorsDataSource, // sqlserverFlexAlphaFlavor.NewFlavorDataSource, - //sqlserverflexalphaInstance.NewInstanceDataSource, - //sqlserverflexalphaUser.NewUserDataSource, - //sqlserverflexalphaDatabase.NewDatabaseDataSource, + sqlserverflexalphaInstance.NewInstanceDataSource, + sqlserverflexalphaUser.NewUserDataSource, + sqlserverflexalphaDatabase.NewDatabaseDataSource, sqlserverFlexBetaDatabase.NewDatabaseDataSource, sqlserverflexBetaInstance.NewInstanceDataSource, sqlserverflexbetaUser.NewUserDataSource, - sqlserverFlexBetaFlavor.NewFlavorDataSource, + // sqlserverFlexBetaFlavor.NewFlavorDataSource, } } @@ -554,9 +554,9 @@ func (p *Provider) Resources(_ context.Context) []func() resource.Resource { postgresFlexAlphaUser.NewUserResource, postgresFlexAlphaDatabase.NewDatabaseResource, - //sqlserverflexalphaInstance.NewInstanceResource, - //sqlserverflexalphaUser.NewUserResource, - //sqlserverflexalphaDatabase.NewDatabaseResource, + sqlserverflexalphaInstance.NewInstanceResource, + sqlserverflexalphaUser.NewUserResource, + sqlserverflexalphaDatabase.NewDatabaseResource, sqlserverflexBetaInstance.NewInstanceResource, sqlserverflexbetaUser.NewUserResource, diff --git a/stackit/provider_acc_test.go b/stackit/provider_acc_test.go index a50503ae..38e22144 100644 --- a/stackit/provider_acc_test.go +++ b/stackit/provider_acc_test.go @@ -10,6 +10,8 @@ import ( "github.com/google/go-cmp/cmp" + sqlserverflexalphaDatabase "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexalpha/database" + //nolint:staticcheck // used for acceptance testing postgresFlexAlphaFlavor "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha/flavor" @@ -21,6 +23,8 @@ import ( postgresflexalphaFlavors "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha/flavors" postgresFlexAlphaInstance "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha/instance" postgresFlexAlphaUser "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha/user" + sqlserverFlexAlphaInstance "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexalpha/instance" + sqlserverFlexAlphaUser "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexalpha/user" sqlserverflexBetaDatabase "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexbeta/database" sqlserverFlexBetaInstance "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexbeta/instance" sqlserverFlexBetaUser "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexbeta/user" @@ -59,9 +63,9 @@ func TestUnitProviderHasChildDataSources_Basic(t *testing.T) { postgresflexalphaFlavors.NewFlavorsDataSource(), // sqlserverFlexAlphaFlavor.NewFlavorDataSource(), - //sqlserverFlexAlphaInstance.NewInstanceDataSource(), - //sqlserverFlexAlphaUser.NewUserDataSource(), - //sqlserverflexalphaDatabase.NewDatabaseDataSource(), + sqlserverFlexAlphaInstance.NewInstanceDataSource(), + sqlserverFlexAlphaUser.NewUserDataSource(), + sqlserverflexalphaDatabase.NewDatabaseDataSource(), sqlserverflexBetaDatabase.NewDatabaseDataSource(), sqlserverFlexBetaInstance.NewInstanceDataSource(), @@ -95,9 +99,9 @@ func TestUnitProviderHasChildResources_Basic(t *testing.T) { postgresFlexAlphaUser.NewUserResource(), postgresFlexAlphaDatabase.NewDatabaseResource(), - //sqlserverFlexAlphaInstance.NewInstanceResource(), - //sqlserverFlexAlphaUser.NewUserResource(), - //sqlserverflexalphaDatabase.NewDatabaseResource(), + sqlserverFlexAlphaInstance.NewInstanceResource(), + sqlserverFlexAlphaUser.NewUserResource(), + sqlserverflexalphaDatabase.NewDatabaseResource(), sqlserverFlexBetaInstance.NewInstanceResource(), sqlserverFlexBetaUser.NewUserResource(),