diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index ad803e70..927f4f0d 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -35,9 +35,10 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - # Initializes the CodeQL tools for scanning. + + # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL uses: github/codeql-action/init@v3 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 775fb4db..15b8cf63 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,13 +20,13 @@ jobs: steps: - name: Checkout - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - name: Unshallow run: git fetch --prune --unshallow - name: Set up Go - uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: go-version-file: go.mod - @@ -38,7 +38,7 @@ jobs: PASSPHRASE: ${{ secrets.PASSPHRASE }} - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v6.3.0 + uses: goreleaser/goreleaser-action@v6.4.0 with: version: latest args: release --clean diff --git a/.github/workflows/terraform_provider_main.yml b/.github/workflows/terraform_provider_main.yml index d7c47e54..7407632d 100644 --- a/.github/workflows/terraform_provider_main.yml +++ b/.github/workflows/terraform_provider_main.yml @@ -37,8 +37,8 @@ jobs: name: go build runs-on: ubuntu-latest steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + - uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 continue-on-error: true id: cache-terraform-plugin-dir timeout-minutes: 2 @@ -46,7 +46,7 @@ jobs: path: terraform-plugin-dir key: ${{ runner.os }}-terraform-plugin-dir-${{ hashFiles('go.sum') }}-${{ hashFiles('provider/**') }} - if: steps.cache-terraform-plugin-dir.outputs.cache-hit != 'true' || steps.cache-terraform-plugin-dir.outcome == 'failure' - uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0 + uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 with: go-version-file: go.mod - if: steps.cache-terraform-plugin-dir.outputs.cache-hit != 'true' || steps.cache-terraform-plugin-dir.outcome == 'failure' @@ -61,8 +61,8 @@ jobs: needs: [go_build] runs-on: ubuntu-latest steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + - uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 continue-on-error: true id: cache-terraform-providers-schema timeout-minutes: 2 @@ -70,7 +70,7 @@ jobs: path: terraform-providers-schema key: ${{ runner.os }}-terraform-providers-schema-${{ hashFiles('go.sum') }}-${{ hashFiles('provider/**') }} - if: steps.cache-terraform-providers-schema.outputs.cache-hit != 'true' || steps.cache-terraform-providers-schema.outcome == 'failure' - uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 + uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 timeout-minutes: 2 with: path: terraform-plugin-dir @@ -107,8 +107,8 @@ jobs: needs: [go_build] runs-on: ubuntu-latest steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 with: go-version-file: go.mod - run: EXECUTE_TESTS=true make testacc TESTARGS='-run="TestAcc(DataSource|Resource)RedisCloud(Essentials|Pro|ActiveActive)Database_.*"' @@ -118,8 +118,8 @@ jobs: needs: [go_test_databases] runs-on: ubuntu-latest steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 with: go-version-file: go.mod - run: EXECUTE_TESTS=true make testacc TESTARGS='-run="TestAcc(DataSource|Resource)RedisCloud(Essentials|Pro|ActiveActive)Subscription_.*"' @@ -129,8 +129,8 @@ jobs: needs: [go_test_subscriptions] runs-on: ubuntu-latest steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 with: go-version-file: go.mod - run: EXECUTE_TESTS=true make testacc TESTARGS='-run="TestAcc(DataSource|Resource)RedisCloudSubscriptionTls_.*"' @@ -140,8 +140,8 @@ jobs: needs: [go_test_subscriptions_tls] runs-on: ubuntu-latest steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 with: go-version-file: go.mod - run: EXECUTE_TESTS=true make testacc TESTARGS='-run="TestAcc(DataSource|Resource)RedisCloudEssentialsPlan_.*"' @@ -151,8 +151,8 @@ jobs: needs: [go_test_essentials_plan] runs-on: ubuntu-latest steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 with: go-version-file: go.mod - run: EXECUTE_TESTS=true make testacc TESTARGS='-run="TestAcc(DataSource|Resource)RedisCloud(DataPersistence|DatabaseModules|Regions|Acl).*"' @@ -162,8 +162,8 @@ jobs: needs: [go_test_persistence_modules_regions_acl] runs-on: ubuntu-latest steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 with: go-version-file: go.mod - run: EXECUTE_TESTS=true make testacc TESTARGS='-test.short -run="TestAcc(DataSource|Resource)RedisCloud(CloudAccount).*"' @@ -173,8 +173,8 @@ jobs: needs: [go_test_cloud_account] runs-on: ubuntu-latest steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 with: go-version-file: go.mod - run: EXECUTE_TESTS=true make testacc TESTARGS='-run="TestAcc(DataSource|Resource)RedisCloud(TransitGatewayAttachment|PaymentMethod).*"' @@ -184,8 +184,8 @@ jobs: needs: [go_build] runs-on: ubuntu-latest steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 with: go-version-file: go.mod - run: make tfproviderlint diff --git a/.github/workflows/terraform_provider_pr.yml b/.github/workflows/terraform_provider_pr.yml index 96ecc32b..365d908f 100644 --- a/.github/workflows/terraform_provider_pr.yml +++ b/.github/workflows/terraform_provider_pr.yml @@ -37,8 +37,8 @@ jobs: name: go build runs-on: ubuntu-latest steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + - uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 continue-on-error: true id: cache-terraform-plugin-dir timeout-minutes: 2 @@ -46,7 +46,7 @@ jobs: path: terraform-plugin-dir key: ${{ runner.os }}-terraform-plugin-dir-${{ hashFiles('go.sum') }}-${{ hashFiles('provider/**') }} - if: steps.cache-terraform-plugin-dir.outputs.cache-hit != 'true' || steps.cache-terraform-plugin-dir.outcome == 'failure' - uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0 + uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 with: go-version-file: go.mod - if: steps.cache-terraform-plugin-dir.outputs.cache-hit != 'true' || steps.cache-terraform-plugin-dir.outcome == 'failure' @@ -61,8 +61,8 @@ jobs: needs: [go_build] runs-on: ubuntu-latest steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + - uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 continue-on-error: true id: cache-terraform-providers-schema timeout-minutes: 2 @@ -70,7 +70,7 @@ jobs: path: terraform-providers-schema key: ${{ runner.os }}-terraform-providers-schema-${{ hashFiles('go.sum') }}-${{ hashFiles('provider/**') }} - if: steps.cache-terraform-providers-schema.outputs.cache-hit != 'true' || steps.cache-terraform-providers-schema.outcome == 'failure' - uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 + uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 timeout-minutes: 2 with: path: terraform-plugin-dir @@ -107,44 +107,43 @@ jobs: needs: [go_build] runs-on: ubuntu-latest steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 with: go-version-file: go.mod - run: EXECUTE_TESTS=true make testacc TESTARGS='-run="TestAccResourceRedisCloudActiveActiveDatabase_CRUDI"' - go_test_smoke_essentials_db: - name: go test smoke essentials db + go_test_smoke_essentials_sub: + name: go test smoke essentials sub needs: [go_build] runs-on: ubuntu-latest steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 with: go-version-file: go.mod - - run: EXECUTE_TESTS=true make testacc TESTARGS='-run="TestAccResourceRedisCloudEssentialsDatabase_CRUDI"' + - run: EXECUTE_TESTS=true make testacc TESTARGS='-run="TestAccResourceRedisCloudEssentialsSubscription"' - go_test_smoke_essentials_sub: - name: go test smoke essentials sub - needs: [go_build] + go_test_smoke_essentials_db: + name: go test smoke essentials db + needs: go_test_smoke_essentials_sub runs-on: ubuntu-latest steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 with: go-version-file: go.mod - - run: EXECUTE_TESTS=true make testacc TESTARGS='-run="TestAccResourceRedisCloudEssentialsSubscription"' - + - run: EXECUTE_TESTS=true make testacc TESTARGS='-run="TestAccResourceRedisCloudEssentialsDatabase_CRUDI"' go_test_smoke_pro_db: name: go test smoke pro db needs: [go_build] runs-on: ubuntu-latest steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 with: go-version-file: go.mod - run: EXECUTE_TESTS=true make testacc TESTARGS='-run="TestAccResourceRedisCloudProDatabase_CRUDI"' @@ -155,19 +154,31 @@ jobs: needs: [ go_build ] runs-on: ubuntu-latest steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 with: go-version-file: go.mod - run: EXECUTE_TESTS=true make testacc TESTARGS='-run="TestAccResourceRedisCloud(PrivateServiceConnect_CRUDI|AclRule_CRUDI)"' + go_test_pro_db_upgrade: + name: go test smoke pro db upgrade + needs: [ go_build ] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 + with: + go-version-file: go.mod + - run: EXECUTE_TESTS=true make testacc TESTARGS='-run="TestAccResourceRedisCloudProDatabase_Upgrade"' + + tfproviderlint: name: tfproviderlint needs: [go_build] runs-on: ubuntu-latest steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 with: go-version-file: go.mod - run: make tfproviderlint diff --git a/CHANGELOG.md b/CHANGELOG.md index d7790807..70d52726 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,20 @@ All notable changes to this project will be documented in this file. See updating [Changelog example here](https://keepachangelog.com/en/1.0.0/) + +# 2.3.0 (15th August 2025) + +### Added + +- Redis Database version support on create. Specify a version on create to create a DB of that version. +- Database upgrade path. If you specify a different version to something already specified, the provider will upgrade your database to the new version. Will fail on downgrade. + +### Changed +- Updating multiple dependencies. + +### Removed +- Deprecate subscription version support. If you use `redis_version` on your pro subscription a warning will come up. This will be removed entirely on a major update. + # 2.2.0 (1st August 2025) ### Added diff --git a/docs/data-sources/rediscloud_active_active_subscription.md b/docs/data-sources/rediscloud_active_active_subscription.md index 15cddf24..b2618d08 100644 --- a/docs/data-sources/rediscloud_active_active_subscription.md +++ b/docs/data-sources/rediscloud_active_active_subscription.md @@ -5,7 +5,7 @@ description: |- Active Active Subscription data source in the Redis Cloud Terraform provider. --- -# Resource: rediscloud_active_active_subscription +# Data Source: rediscloud_active_active_subscription This data source allows access to the details of an existing subscription within your Redis Enterprise Cloud account. diff --git a/docs/data-sources/rediscloud_active_active_subscription_database.md b/docs/data-sources/rediscloud_active_active_subscription_database.md index 86409140..306a33ed 100644 --- a/docs/data-sources/rediscloud_active_active_subscription_database.md +++ b/docs/data-sources/rediscloud_active_active_subscription_database.md @@ -5,7 +5,7 @@ description: |- Database data source for Active-Active Subscriptions in the Redis Cloud Terraform provider. --- -# Resource: rediscloud_active_active_subscription_database +# Data Source: rediscloud_active_active_subscription_database This data source allows access to the details of an existing database within your Redis Enterprise Cloud account. @@ -45,6 +45,7 @@ data "rediscloud_active_active_subscription_database" "example" { * `memory_limit_in_gb` - The maximum memory usage for the database. * `dataset_size_in_gb` - Maximum amount of data in the dataset for this specific database in GB. * `support_oss_cluster_api` - Supports the Redis open-source (OSS) Cluster API. +* `redis_version` - The Redis version of the database. * `external_endpoint_for_oss_cluster_api` - Use the external endpoint for open-source (OSS) Cluster API. * `enable_tls` - Enable TLS for database. * `tls_certificate` - TLS certificate used for authentication. diff --git a/docs/data-sources/rediscloud_database.md b/docs/data-sources/rediscloud_database.md index 1edc3f6e..ff48187a 100644 --- a/docs/data-sources/rediscloud_database.md +++ b/docs/data-sources/rediscloud_database.md @@ -45,6 +45,7 @@ data "rediscloud_database" "example" { * `memory_limit_in_gb` - The maximum memory usage for the database. * `dataset_size_in_gb` - Maximum amount of data in the dataset for this specific database in GB. * `support_oss_cluster_api` - Supports the Redis open-source (OSS) Cluster API. +* `redis_version` - The Redis version of the database. * `resp_version` - Either `resp2` or `resp3`. Database's RESP version. * `replica_of` - The set of Redis database URIs, in the format `redis://user:password@host:port`, that this database will be a replica of. diff --git a/docs/data-sources/rediscloud_essentials_database.md b/docs/data-sources/rediscloud_essentials_database.md index f2e36ca9..6b89ee42 100644 --- a/docs/data-sources/rediscloud_essentials_database.md +++ b/docs/data-sources/rediscloud_essentials_database.md @@ -5,7 +5,7 @@ description: |- Database data source for Essentials Subscriptions in the Redis Cloud Terraform provider. --- -# Resource: rediscloud_essentials_database +# Data Source: rediscloud_essentials_database This data source allows access to the details of an existing database within your Redis Enterprise Cloud account. diff --git a/docs/resources/rediscloud_subscription.md b/docs/resources/rediscloud_subscription.md index d3e463b1..31ef8cda 100644 --- a/docs/resources/rediscloud_subscription.md +++ b/docs/resources/rediscloud_subscription.md @@ -34,7 +34,6 @@ resource "rediscloud_subscription" "subscription-resource" { payment_method = "credit-card" payment_method_id = data.rediscloud_payment_method.card.id memory_storage = "ram" - redis_version = "7.2" cloud_provider { provider = data.rediscloud_cloud_account.account.provider_type @@ -76,7 +75,7 @@ The following arguments are supported: * `payment_method` (Optional) The payment method for the requested subscription, (either `credit-card` or `marketplace`). If `credit-card` is specified, `payment_method_id` must be defined. Default: 'credit-card'. **(Changes to) this attribute are ignored after creation.** * `payment_method_id` - (Optional) A valid payment method pre-defined in the current account. Only __Required__ when `payment_method` is `credit-card`. * `memory_storage` - (Optional) Memory storage preference: either ‘ram’ or a combination of ‘ram-and-flash’. Default: ‘ram’. **Modifying this attribute will force creation of a new resource.** -* `redis_version` - (Optional) The Redis version of the databases in the subscription. If omitted, the Redis version will be the default. **Modifying this attribute will force creation of a new resource.** +* `redis_version` - (Optional) The Redis version of the databases in the subscription. If omitted, the Redis version will be the default. **Deprecated: This attribute is deprecated on pro subscriptions. Please specify `redis_version` on databases directly instead.** * `allowlist` - (Optional) An allowlist object, documented below * `cloud_provider` - (Required) A cloud provider object, documented below. **Modifying this attribute will force creation of a new resource.** * `creation_plan` - (Required) A creation plan object, documented below. diff --git a/docs/resources/rediscloud_subscription_database.md b/docs/resources/rediscloud_subscription_database.md index f4ef95a2..37c87e52 100644 --- a/docs/resources/rediscloud_subscription_database.md +++ b/docs/resources/rediscloud_subscription_database.md @@ -80,6 +80,7 @@ The following arguments are supported: * `subscription_id` - (Required) The ID of the subscription to create the database in. **Modifying this attribute will force creation of a new resource.** * `name` - (Required) A meaningful name to identify the database +* `redis_version` - (Optional) The Redis version of the database. If omitted, the Redis version will be the default. * `throughput_measurement_by` - (Required) Throughput measurement method that will be used by your databases. Either `number-of-shards` or `operations-per-second`. **`number-of-shards` is deprecated and only supported for legacy deployments.** * `throughput_measurement_value` - (Required) Throughput value (as applies to selected measurement method) * `memory_limit_in_gb` - (Optional - **Required if `dataset_size_in_gb` is unset**) Maximum memory usage for this specific database, including replication and other overhead **Deprecated in favor of `dataset_size_in_gb` - not possible to import databases with this attribute set** diff --git a/go.mod b/go.mod index dda23d2f..38e69efd 100644 --- a/go.mod +++ b/go.mod @@ -1,43 +1,45 @@ module github.com/RedisLabs/terraform-provider-rediscloud -go 1.22.4 +go 1.23.0 + +toolchain go1.24.1 require ( - github.com/RedisLabs/rediscloud-go-api v0.31.0 + github.com/RedisLabs/rediscloud-go-api v0.34.2 github.com/bflad/tfproviderlint v0.31.0 github.com/hashicorp/go-cty v1.5.0 - github.com/hashicorp/terraform-plugin-sdk/v2 v2.36.1 + github.com/hashicorp/terraform-plugin-sdk/v2 v2.37.0 github.com/stretchr/testify v1.10.0 ) require ( - github.com/ProtonMail/go-crypto v1.1.3 // indirect + github.com/ProtonMail/go-crypto v1.1.6 // indirect github.com/agext/levenshtein v1.2.2 // indirect github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect github.com/avast/retry-go/v4 v4.6.0 // indirect github.com/bflad/gopaniccheck v0.1.0 // indirect - github.com/cloudflare/circl v1.3.7 // indirect + github.com/cloudflare/circl v1.6.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/fatih/color v1.16.0 // indirect github.com/golang/protobuf v1.5.4 // indirect - github.com/google/go-cmp v0.6.0 // indirect + github.com/google/go-cmp v0.7.0 // indirect github.com/hashicorp/errwrap v1.0.0 // indirect github.com/hashicorp/go-checkpoint v0.5.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // 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.6.2 // indirect + github.com/hashicorp/go-plugin v1.6.3 // indirect github.com/hashicorp/go-retryablehttp v0.7.7 // indirect github.com/hashicorp/go-uuid v1.0.3 // indirect github.com/hashicorp/go-version v1.7.0 // indirect - github.com/hashicorp/hc-install v0.9.1 // indirect + github.com/hashicorp/hc-install v0.9.2 // indirect github.com/hashicorp/hcl/v2 v2.23.0 // indirect github.com/hashicorp/logutils v1.0.0 // indirect - github.com/hashicorp/terraform-exec v0.22.0 // indirect - github.com/hashicorp/terraform-json v0.24.0 // indirect - github.com/hashicorp/terraform-plugin-go v0.26.0 // indirect + github.com/hashicorp/terraform-exec v0.23.0 // indirect + github.com/hashicorp/terraform-json v0.25.0 // indirect + github.com/hashicorp/terraform-plugin-go v0.27.0 // indirect github.com/hashicorp/terraform-plugin-log v0.9.0 // indirect - github.com/hashicorp/terraform-registry-address v0.2.4 // indirect + github.com/hashicorp/terraform-registry-address v0.2.5 // indirect github.com/hashicorp/terraform-svchost v0.1.1 // indirect github.com/hashicorp/yamux v0.1.1 // indirect github.com/mattn/go-colorable v0.1.13 // indirect @@ -53,17 +55,17 @@ require ( github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect github.com/zclconf/go-cty v1.16.2 // indirect - golang.org/x/crypto v0.33.0 // indirect - golang.org/x/mod v0.23.0 // indirect - golang.org/x/net v0.35.0 // indirect - golang.org/x/sync v0.11.0 // indirect - golang.org/x/sys v0.30.0 // indirect - golang.org/x/text v0.22.0 // indirect - golang.org/x/tools v0.30.0 // indirect + golang.org/x/crypto v0.41.0 // indirect + golang.org/x/mod v0.27.0 // indirect + golang.org/x/net v0.43.0 // indirect + golang.org/x/sync v0.16.0 // indirect + golang.org/x/sys v0.35.0 // indirect + golang.org/x/text v0.28.0 // indirect + golang.org/x/tools v0.36.0 // indirect google.golang.org/appengine v1.6.8 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53 // indirect - google.golang.org/grpc v1.69.4 // indirect - google.golang.org/protobuf v1.36.3 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20250218202821-56aae31c358a // indirect + google.golang.org/grpc v1.72.1 // indirect + google.golang.org/protobuf v1.36.6 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 0d5e5a0c..7da6fc31 100644 --- a/go.sum +++ b/go.sum @@ -1,11 +1,11 @@ dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= -github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= -github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= -github.com/ProtonMail/go-crypto v1.1.3 h1:nRBOetoydLeUb4nHajyO2bKqMLfWQ/ZPwkXqXxPxCFk= -github.com/ProtonMail/go-crypto v1.1.3/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE= -github.com/RedisLabs/rediscloud-go-api v0.31.0 h1:hFdR7nrJcCVQN8h3DeXtP0g4zVQP6X5wtS5FoinG8bo= -github.com/RedisLabs/rediscloud-go-api v0.31.0/go.mod h1:3/oVb71rv2OstFRYEc65QCIbfwnJTgZeQhtPCcdHook= +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.1.6 h1:ZcV+Ropw6Qn0AX9brlQLAUXfqLBc7Bl+f/DmNxpLfdw= +github.com/ProtonMail/go-crypto v1.1.6/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE= +github.com/RedisLabs/rediscloud-go-api v0.34.2 h1:K31RyQ0Soow07k9oBdxMAyY45sS+yGcZYuCY0c3gqLU= +github.com/RedisLabs/rediscloud-go-api v0.34.2/go.mod h1:SdjSIrfqR653L+K4Bcpr1HIoiCSluDGIKak+qBelB/M= github.com/agext/levenshtein v1.2.2 h1:0S/Yg6LYmFJ5stwQeRp6EeOcCbj7xiqQSdNelsXvaqE= github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec= @@ -19,10 +19,10 @@ github.com/bflad/tfproviderlint v0.31.0 h1:9N/dUzFARsTpAQOjdZzIWnHKMzQc7UDDEYrSN github.com/bflad/tfproviderlint v0.31.0/go.mod h1:yZQdJs4uobBIgVHt1Tv5OpHhgM8fwh29OgxL/La5BFs= github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA= github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp+BagBSZWx+TP8= -github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU= -github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA= -github.com/cyphar/filepath-securejoin v0.2.5 h1:6iR5tXJ/e6tJZzzdMc1km3Sa7RRIVBKAK32O2s7AYfo= -github.com/cyphar/filepath-securejoin v0.2.5/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= +github.com/cloudflare/circl v1.6.1 h1:zqIqSPIndyBh1bjLVVDHMPpVKqp8Su/V+6MeDzzQBQ0= +github.com/cloudflare/circl v1.6.1/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZh3pJrofs= +github.com/cyphar/filepath-securejoin v0.4.1 h1:JyxxyPEaktOD+GAnqIqTf9A8tHyAG22rowi7HkoSU1s= +github.com/cyphar/filepath-securejoin v0.4.1/go.mod h1:Sdj7gXlvMcPZsbhwhQ33GguGLDGQL7h7bg04C/+u9jI= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -33,18 +33,18 @@ github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= 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.6.0 h1:w2hPNtoehvJIxR00Vb4xX94qHQi/ApZfX+nBE2Cjio8= -github.com/go-git/go-billy/v5 v5.6.0/go.mod h1:sFDq7xD3fn3E0GOwUSZqHo9lrkmx8xJhA0ZrfvjBRGM= -github.com/go-git/go-git/v5 v5.13.0 h1:vLn5wlGIh/X78El6r3Jr+30W16Blk0CTcxTYcYPWi5E= -github.com/go-git/go-git/v5 v5.13.0/go.mod h1:Wjo7/JyVKtQgUNdXYXIepzWfJQkUEIGvkvVkiXRR/zw= +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.14.0 h1:/MD3lCrGjCen5WfEAzKg00MJJffKhC8gzS80ycmCi60= +github.com/go-git/go-git/v5 v5.14.0/go.mod h1:Z5Xhoia5PcWA3NF8vRLURn9E5FRhSl7dGj9ItW3Wk5k= github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68= github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 h1:f+oWsMOmNPc8JmEHVZIycC7hBoQxHH9pNKQORJNozsQ= +github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8/go.mod h1:wcDNUvekVysuuOpQKo3191zZyTpiI6se1N1ULghS0sw= github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= @@ -52,8 +52,8 @@ github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +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.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= @@ -69,8 +69,8 @@ github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB1 github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= 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.6.2 h1:zdGAEd0V1lCaU0u+MxWQhtSDQmahpkwOun8U8EiRVog= -github.com/hashicorp/go-plugin v1.6.2/go.mod h1:CkgLQ5CZqNmdL9U9JzM532t8ZiYQ35+pj3b1FD37R0Q= +github.com/hashicorp/go-plugin v1.6.3 h1:xgHB+ZUSYeuJi96WtxEjzi23uh7YQpznjGh0U0UUrwg= +github.com/hashicorp/go-plugin v1.6.3/go.mod h1:MRobyh+Wc/nYy1V4KAXUiYfzxoYhs7V1mlH1Z7iY2h0= github.com/hashicorp/go-retryablehttp v0.7.7 h1:C8hUCYzor8PIfXHa4UrZkU4VvK8o9ISHxT2Q8+VepXU= github.com/hashicorp/go-retryablehttp v0.7.7/go.mod h1:pkQpWZeYWskR+D1tR2O5OcBFOxfA7DoAO6xtkuQnHTk= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= @@ -78,24 +78,24 @@ 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.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY= github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/hc-install v0.9.1 h1:gkqTfE3vVbafGQo6VZXcy2v5yoz2bE0+nhZXruCuODQ= -github.com/hashicorp/hc-install v0.9.1/go.mod h1:pWWvN/IrfeBK4XPeXXYkL6EjMufHkCK5DvwxeLKuBf0= +github.com/hashicorp/hc-install v0.9.2 h1:v80EtNX4fCVHqzL9Lg/2xkp62bbvQMnvPQ0G+OmtO24= +github.com/hashicorp/hc-install v0.9.2/go.mod h1:XUqBQNnuT4RsxoxiM9ZaUk0NX8hi2h+Lb6/c0OZnC/I= github.com/hashicorp/hcl/v2 v2.23.0 h1:Fphj1/gCylPxHutVSEOf2fBOh1VE4AuLV7+kbJf3qos= github.com/hashicorp/hcl/v2 v2.23.0/go.mod h1:62ZYHrXgPoX8xBnzl8QzbWq4dyDsDtfCRgIq1rbJEvA= 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.22.0 h1:G5+4Sz6jYZfRYUCg6eQgDsqTzkNXV+fP8l+uRmZHj64= -github.com/hashicorp/terraform-exec v0.22.0/go.mod h1:bjVbsncaeh8jVdhttWYZuBGj21FcYw6Ia/XfHcNO7lQ= -github.com/hashicorp/terraform-json v0.24.0 h1:rUiyF+x1kYawXeRth6fKFm/MdfBS6+lW4NbeATsYz8Q= -github.com/hashicorp/terraform-json v0.24.0/go.mod h1:Nfj5ubo9xbu9uiAoZVBsNOjvNKB66Oyrvtit74kC7ow= -github.com/hashicorp/terraform-plugin-go v0.26.0 h1:cuIzCv4qwigug3OS7iKhpGAbZTiypAfFQmw8aE65O2M= -github.com/hashicorp/terraform-plugin-go v0.26.0/go.mod h1:+CXjuLDiFgqR+GcrM5a2E2Kal5t5q2jb0E3D57tTdNY= +github.com/hashicorp/terraform-exec v0.23.0 h1:MUiBM1s0CNlRFsCLJuM5wXZrzA3MnPYEsiXmzATMW/I= +github.com/hashicorp/terraform-exec v0.23.0/go.mod h1:mA+qnx1R8eePycfwKkCRk3Wy65mwInvlpAeOwmA7vlY= +github.com/hashicorp/terraform-json v0.25.0 h1:rmNqc/CIfcWawGiwXmRuiXJKEiJu1ntGoxseG1hLhoQ= +github.com/hashicorp/terraform-json v0.25.0/go.mod h1:sMKS8fiRDX4rVlR6EJUMudg1WcanxCMoWwTLkgZP/vc= +github.com/hashicorp/terraform-plugin-go v0.27.0 h1:ujykws/fWIdsi6oTUT5Or4ukvEan4aN9lY+LOxVP8EE= +github.com/hashicorp/terraform-plugin-go v0.27.0/go.mod h1:FDa2Bb3uumkTGSkTFpWSOwWJDwA7bf3vdP3ltLDTH6o= github.com/hashicorp/terraform-plugin-log v0.9.0 h1:i7hOA+vdAItN1/7UrfBqBwvYPQ9TFvymaRGZED3FCV0= github.com/hashicorp/terraform-plugin-log v0.9.0/go.mod h1:rKL8egZQ/eXSyDqzLUuwUYLVdlYeamldAHSxjUFADow= -github.com/hashicorp/terraform-plugin-sdk/v2 v2.36.1 h1:WNMsTLkZf/3ydlgsuXePa3jvZFwAJhruxTxP/c1Viuw= -github.com/hashicorp/terraform-plugin-sdk/v2 v2.36.1/go.mod h1:P6o64QS97plG44iFzSM6rAn6VJIC/Sy9a9IkEtl79K4= -github.com/hashicorp/terraform-registry-address v0.2.4 h1:JXu/zHB2Ymg/TGVCRu10XqNa4Sh2bWcqCNyKWjnCPJA= -github.com/hashicorp/terraform-registry-address v0.2.4/go.mod h1:tUNYTVyCtU4OIGXXMDp7WNcJ+0W1B4nmstVDgHMjfAU= +github.com/hashicorp/terraform-plugin-sdk/v2 v2.37.0 h1:NFPMacTrY/IdcIcnUB+7hsore1ZaRWU9cnB6jFoBnIM= +github.com/hashicorp/terraform-plugin-sdk/v2 v2.37.0/go.mod h1:QYmYnLfsosrxjCnGY1p9c7Zj6n9thnEE+7RObeYs3fA= +github.com/hashicorp/terraform-registry-address v0.2.5 h1:2GTftHqmUhVOeuu9CW3kwDkRe4pcBDq0uuK5VJngU1M= +github.com/hashicorp/terraform-registry-address v0.2.5/go.mod h1:PpzXWINwB5kuVS5CA7m1+eO2f1jKb5ZDIxrOPfpnGkg= github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S52uzrw4x0jKQ= github.com/hashicorp/terraform-svchost v0.1.1/go.mod h1:mNsjQfZyf/Jhz35v6/0LWcv26+X7JPS+buii2c9/ctc= github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= @@ -132,14 +132,14 @@ github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zx github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= -github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4= -github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI= +github.com/pjbgf/sha1cd v0.3.2 h1:a9wb0bp1oC2TGwStyn0Umc/IGKQnEgF0vVaZ8QF8eo4= +github.com/pjbgf/sha1cd v0.3.2/go.mod h1:zQWigSxVmsHEZow5qaLtPYxpcKMMQpa09ixqBxuCS6A= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 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/skeema/knownhosts v1.3.0 h1:AM+y0rI04VksttfwjkSTNQorvGqmwATnvnAHpSgc0LY= -github.com/skeema/knownhosts v1.3.0/go.mod h1:sPINvnADmT/qYH1kfv+ePMmOBTH6Tbl7b5LvTDjFK7M= +github.com/skeema/knownhosts v1.3.1 h1:X2osQ+RAjK76shCbvhHHHVl3ZlgDm8apHEHFqRjnBY8= +github.com/skeema/knownhosts v1.3.1/go.mod h1:r7KTdC8l4uxWRyK2TpQZ/1o5HaSzh06ePQNxPwTcfiY= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= @@ -160,36 +160,38 @@ github.com/zclconf/go-cty v1.16.2 h1:LAJSwc3v81IRBZyUVQDUdZ7hs3SYs9jv0eZJDWHD/70 github.com/zclconf/go-cty v1.16.2/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= 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.opentelemetry.io/otel v1.31.0 h1:NsJcKPIW0D0H3NgzPDHmo0WW6SptzPdqg/L1zsIm2hY= -go.opentelemetry.io/otel v1.31.0/go.mod h1:O0C14Yl9FgkjqcCZAsE053C13OaddMYr/hz6clDkEJE= -go.opentelemetry.io/otel/metric v1.31.0 h1:FSErL0ATQAmYHUIzSezZibnyVlft1ybhy4ozRPcF2fE= -go.opentelemetry.io/otel/metric v1.31.0/go.mod h1:C3dEloVbLuYoX41KpmAhOqNriGbA+qqH6PQ5E5mUfnY= -go.opentelemetry.io/otel/sdk v1.31.0 h1:xLY3abVHYZ5HSfOg3l2E5LUj2Cwva5Y7yGxnSW9H5Gk= -go.opentelemetry.io/otel/sdk v1.31.0/go.mod h1:TfRbMdhvxIIr/B2N2LQW2S5v9m3gOQ/08KsbbO5BPT0= -go.opentelemetry.io/otel/sdk/metric v1.31.0 h1:i9hxxLJF/9kkvfHppyLL55aW7iIJz4JjxTeYusH7zMc= -go.opentelemetry.io/otel/sdk/metric v1.31.0/go.mod h1:CRInTMVvNhUKgSAMbKyTMxqOBC0zgyxzW55lZzX43Y8= -go.opentelemetry.io/otel/trace v1.31.0 h1:ffjsj1aRouKewfr85U2aGagJ46+MvodynlQ1HYdmJys= -go.opentelemetry.io/otel/trace v1.31.0/go.mod h1:TXZkRk7SM2ZQLtR6eoAWQFIHPvzQ06FJAsO1tJg480A= +go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= +go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= +go.opentelemetry.io/otel v1.34.0 h1:zRLXxLCgL1WyKsPVrgbSdMN4c0FMkDAskSTQP+0hdUY= +go.opentelemetry.io/otel v1.34.0/go.mod h1:OWFPOQ+h4G8xpyjgqo4SxJYdDQ/qmRH+wivy7zzx9oI= +go.opentelemetry.io/otel/metric v1.34.0 h1:+eTR3U0MyfWjRDhmFMxe2SsW64QrZ84AOhvqS7Y+PoQ= +go.opentelemetry.io/otel/metric v1.34.0/go.mod h1:CEDrp0fy2D0MvkXE+dPV7cMi8tWZwX3dmaIhwPOaqHE= +go.opentelemetry.io/otel/sdk v1.34.0 h1:95zS4k/2GOy069d321O8jWgYsW3MzVV+KuSPKp7Wr1A= +go.opentelemetry.io/otel/sdk v1.34.0/go.mod h1:0e/pNiaMAqaykJGKbi+tSjWfNNHMTxoC9qANsCzbyxU= +go.opentelemetry.io/otel/sdk/metric v1.34.0 h1:5CeK9ujjbFVL5c1PhLuStg1wxA7vQv7ce1EK0Gyvahk= +go.opentelemetry.io/otel/sdk/metric v1.34.0/go.mod h1:jQ/r8Ze28zRKoNRdkjCZxfs6YvBTG1+YIqyFVFYec5w= +go.opentelemetry.io/otel/trace v1.34.0 h1:+ouXS2V8Rd4hp4580a8q23bg0azF2nI8cqLYnC8mh/k= +go.opentelemetry.io/otel/trace v1.34.0/go.mod h1:Svm7lSjQD7kG7KJ/MUHPVXSDGz2OX4h0M2jHBhmSfRE= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.33.0 h1:IOBPskki6Lysi0lo9qQvbxiQ+FvsCC/YWOecCHAixus= -golang.org/x/crypto v0.33.0/go.mod h1:bVdXmD7IV/4GdElGPozy6U7lWdRXA4qyRVGJV57uQ5M= +golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4= +golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.23.0 h1:Zb7khfcRGKk+kqfxFaP5tZqCnDZMjC5VtUBs87Hr6QM= -golang.org/x/mod v0.23.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= +golang.org/x/mod v0.27.0 h1:kb+q2PyFnEADO2IEF935ehFUXlWiNjJWtRNgBLSfbxQ= +golang.org/x/mod v0.27.0/go.mod h1:rWI627Fq0DEoudcK+MBkNkCe0EetEaDSwJJkCcjpazc= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 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.35.0 h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8= -golang.org/x/net v0.35.0/go.mod h1:EglIi67kWsHKlRzzVMUD93VMSWGFOMSZgxFjparz1Qk= +golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= +golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w= -golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw= +golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -203,38 +205,38 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc= -golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= +golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= 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.29.0 h1:L6pJp37ocefwRRtYPKSWOWzOtWSxVajvz2ldH/xi3iU= -golang.org/x/term v0.29.0/go.mod h1:6bl4lRlvVuDgSf3179VpIxBF0o10JUpXWOnI7nErv7s= +golang.org/x/term v0.34.0 h1:O/2T7POpk0ZZ7MAzMeWFSg6S5IpWd/RXDlM9hgM3DR4= +golang.org/x/term v0.34.0/go.mod h1:5jC53AEywhIVebHgPVeg0mj8OD3VO9OzclacVrqpaAw= 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.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM= -golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY= +golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= +golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200214201135-548b770e2dfa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.30.0 h1:BgcpHewrV5AUp2G9MebG4XPFI1E2W41zU1SaqVA9vJY= -golang.org/x/tools v0.30.0/go.mod h1:c347cR/OJfw5TI+GfX7RUPNMdDRRbjvYTS0jPyvsVtY= +golang.org/x/tools v0.36.0 h1:kWS0uv/zsvHEle1LbV5LE8QujrxB3wfQyxHfhOk0Qkg= +golang.org/x/tools v0.36.0/go.mod h1:WBDiHKJK8YgLHlcQPYQzNCkUxUypCaa5ZegCVutKm+s= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 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-20241015192408-796eee8c2d53 h1:X58yt85/IXCx0Y3ZwN6sEIKZzQtDEYaBWrDvErdXrRE= -google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI= -google.golang.org/grpc v1.69.4 h1:MF5TftSMkd8GLw/m0KM6V8CMOCY6NZ1NQDPGFgbTt4A= -google.golang.org/grpc v1.69.4/go.mod h1:vyjdE6jLBI76dgpDojsFGNaHlxdjXN9ghpnd2o7JGZ4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250218202821-56aae31c358a h1:51aaUVRocpvUOSQKM6Q7VuoaktNIaMCLuhZB6DKksq4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250218202821-56aae31c358a/go.mod h1:uRxBH1mhmO8PGhU89cMcHaXKZqO+OfakD8QQO0oYwlQ= +google.golang.org/grpc v1.72.1 h1:HR03wO6eyZ7lknl75XlxABNVLLFc2PAb6mHlYh756mA= +google.golang.org/grpc v1.72.1/go.mod h1:wH5Aktxcg25y1I3w7H69nHfXdOG3UiadoBtjh3izSDM= 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.3 h1:82DV7MYdb8anAVi3qge1wSnMDrnKK7ebr+I0hHRN1BU= -google.golang.org/protobuf v1.36.3/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= +google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/provider/datasource_rediscloud_active_active_database.go b/provider/datasource_rediscloud_active_active_database.go index 98dfe697..695338ef 100644 --- a/provider/datasource_rediscloud_active_active_database.go +++ b/provider/datasource_rediscloud_active_active_database.go @@ -43,6 +43,11 @@ func dataSourceRedisCloudActiveActiveDatabase() *schema.Resource { Type: schema.TypeFloat, Computed: true, }, + "redis_version": { + Description: "The redis version of the database", + Type: schema.TypeString, + Computed: true, + }, "support_oss_cluster_api": { Description: "Support Redis open-source (OSS) Cluster API", Type: schema.TypeBool, @@ -298,6 +303,11 @@ func dataSourceRedisCloudActiveActiveDatabaseRead(ctx context.Context, d *schema if err := d.Set("dataset_size_in_gb", redis.Float64(*db.CrdbDatabases[0].DatasetSizeInGB)); err != nil { return diag.FromErr(err) } + + if err := d.Set("redis_version", redis.String(*db.RedisVersion)); err != nil { + return diag.FromErr(err) + } + if err := d.Set("support_oss_cluster_api", redis.BoolValue(db.SupportOSSClusterAPI)); err != nil { return diag.FromErr(err) } diff --git a/provider/datasource_rediscloud_pro_database.go b/provider/datasource_rediscloud_pro_database.go index 8b76ce26..1bb336be 100644 --- a/provider/datasource_rediscloud_pro_database.go +++ b/provider/datasource_rediscloud_pro_database.go @@ -59,6 +59,11 @@ func dataSourceRedisCloudProDatabase() *schema.Resource { Type: schema.TypeFloat, Computed: true, }, + "redis_version": { + Description: "The redis version of the database", + Type: schema.TypeString, + Computed: true, + }, "query_performance_factor": { Description: "Query performance factor for this specific database", Type: schema.TypeString, @@ -485,6 +490,10 @@ func dataSourceRedisCloudProDatabaseRead(ctx context.Context, d *schema.Resource return diag.FromErr(err) } + if err := d.Set("redis_version", redis.String(*db.RedisVersion)); err != nil { + return diag.FromErr(err) + } + return diags } diff --git a/provider/datasource_rediscloud_pro_database_test.go b/provider/datasource_rediscloud_pro_database_test.go index 23654de7..b1971de0 100644 --- a/provider/datasource_rediscloud_pro_database_test.go +++ b/provider/datasource_rediscloud_pro_database_test.go @@ -13,12 +13,11 @@ func TestAccDataSourceRedisCloudProDatabase_basic(t *testing.T) { testAccRequiresEnvVar(t, "EXECUTE_TESTS") - name := acctest.RandomWithPrefix(testResourcePrefix) - password := acctest.RandString(20) - testCloudAccountName := os.Getenv("AWS_TEST_CLOUD_ACCOUNT_NAME") - const dataSourceById = "data.rediscloud_database.example-by-id" const dataSourceByName = "data.rediscloud_database.example-by-name" + password := acctest.RandString(20) + + config := getRedisProDbDatasourceConfig(t, password) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAwsPreExistingCloudAccountPreCheck(t) }, @@ -26,7 +25,7 @@ func TestAccDataSourceRedisCloudProDatabase_basic(t *testing.T) { CheckDestroy: testAccCheckProSubscriptionDestroy, Steps: []resource.TestStep{ { - Config: fmt.Sprintf(testAccDatasourceRedisCloudProDatabase, testCloudAccountName, name, password), + Config: config, Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(dataSourceById, "name", "tf-database"), resource.TestCheckResourceAttr(dataSourceById, "protocol", "redis"), @@ -61,74 +60,22 @@ func TestAccDataSourceRedisCloudProDatabase_basic(t *testing.T) { resource.TestCheckResourceAttrSet(dataSourceByName, "private_endpoint"), resource.TestCheckResourceAttr(dataSourceByName, "enable_default_user", "true"), resource.TestCheckResourceAttr(dataSourceByName, "query_performance_factor", "2x"), + resource.TestCheckResourceAttr(dataSourceByName, "redis_version", "7.2"), ), }, }, }) -} -const testAccDatasourceRedisCloudProDatabase = ` -data "rediscloud_payment_method" "card" { - card_type = "Visa" - last_four_numbers = "5556" } -data "rediscloud_cloud_account" "account" { - exclude_internal_account = true - provider_type = "AWS" - name = "%s" -} -resource "rediscloud_subscription" "example" { - name = "%s" - payment_method_id = data.rediscloud_payment_method.card.id - memory_storage = "ram" - cloud_provider { - provider = data.rediscloud_cloud_account.account.provider_type - cloud_account_id = data.rediscloud_cloud_account.account.id - region { - region = "eu-west-1" - networking_deployment_cidr = "10.0.0.0/24" - preferred_availability_zones = ["eu-west-1a"] - } - } - creation_plan { - memory_limit_in_gb = 1 - quantity = 1 - replication=false - support_oss_cluster_api=true - throughput_measurement_by = "operations-per-second" - throughput_measurement_value = 1000 - query_performance_factor = "2x" - modules = ["RediSearch"] - } -} -resource "rediscloud_subscription_database" "example" { - subscription_id = rediscloud_subscription.example.id - name = "tf-database" - protocol = "redis" - memory_limit_in_gb = 1 - data_persistence = "none" - throughput_measurement_by = "operations-per-second" - throughput_measurement_value = 1000 - password = "%s" - support_oss_cluster_api = true - replication = false - enable_default_user = true - query_performance_factor = "2x" - modules = [ - { - name: "RediSearch" - } - ] -} +func getRedisProDbDatasourceConfig(t *testing.T, password string) string { + testCloudAccountName := os.Getenv("AWS_TEST_CLOUD_ACCOUNT_NAME") + subscriptionName := acctest.RandomWithPrefix(testResourcePrefix) -data "rediscloud_database" "example-by-id" { - subscription_id = rediscloud_subscription.example.id - db_id = rediscloud_subscription_database.example.db_id -} + content, err := os.ReadFile("./testdata/testAccDatasourceRedisCloudProDatabase.tf") + if err != nil { + t.Fatalf("failed to read file: %v", err) + } -data "rediscloud_database" "example-by-name" { - subscription_id = rediscloud_subscription.example.id - name = rediscloud_subscription_database.example.name + return fmt.Sprintf(string(content), testCloudAccountName, subscriptionName, password) } -` diff --git a/provider/rediscloud_active_active_database_test.go b/provider/rediscloud_active_active_database_test.go index bc0cc996..6a0abb62 100644 --- a/provider/rediscloud_active_active_database_test.go +++ b/provider/rediscloud_active_active_database_test.go @@ -144,6 +144,7 @@ func TestAccResourceRedisCloudActiveActiveDatabase_CRUDI(t *testing.T) { resource.TestCheckResourceAttr(databaseResourceName, "global_alert.#", "1"), resource.TestCheckResourceAttr(databaseResourceName, "global_alert.0.name", "dataset-size"), resource.TestCheckResourceAttr(databaseResourceName, "global_alert.0.value", "60"), + resource.TestCheckResourceAttr(databaseResourceName, "redis_version", "7.2"), // Changes are ignored after creation resource.TestCheckResourceAttr(databaseResourceName, "global_modules.#", "1"), @@ -161,6 +162,7 @@ func TestAccResourceRedisCloudActiveActiveDatabase_CRUDI(t *testing.T) { // Test datasource resource.TestCheckResourceAttr(datasourceName, "dataset_size_in_gb", "1"), resource.TestCheckResourceAttr(datasourceName, "support_oss_cluster_api", "true"), + resource.TestCheckResourceAttr(datasourceName, "redis_version", "7.2"), resource.TestCheckResourceAttr(datasourceName, "external_endpoint_for_oss_cluster_api", "true"), ), }, @@ -299,6 +301,7 @@ resource "rediscloud_active_active_subscription_database" "example" { support_oss_cluster_api = false external_endpoint_for_oss_cluster_api = false enable_tls = false + redis_version = "7.2" global_data_persistence = "none" global_password = "%s" @@ -327,8 +330,8 @@ resource "rediscloud_active_active_subscription_database" "example" { "priority" = "code-2" } -} -// +} + data "rediscloud_active_active_subscription_database" "example" { subscription_id = rediscloud_active_active_subscription.example.id name = rediscloud_active_active_subscription_database.example.name @@ -415,7 +418,6 @@ resource "rediscloud_active_active_subscription" "example" { name = "%s" payment_method_id = data.rediscloud_payment_method.card.id cloud_provider = "AWS" - redis_version = "latest" creation_plan { dataset_size_in_gb = 1 diff --git a/provider/rediscloud_essentials_subscription_test.go b/provider/rediscloud_essentials_subscription_test.go index 4b1a3aea..87dbdaba 100644 --- a/provider/rediscloud_essentials_subscription_test.go +++ b/provider/rediscloud_essentials_subscription_test.go @@ -26,7 +26,7 @@ func TestAccResourceRedisCloudEssentialsSubscription_Free_CRUDI(t *testing.T) { const resourceName = "rediscloud_essentials_subscription.example" const datasourceName = "data.rediscloud_essentials_subscription.example" - resource.ParallelTest(t, resource.TestCase{ + resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, ProviderFactories: providerFactories, CheckDestroy: testAccCheckEssentialsSubscriptionDestroy, @@ -91,7 +91,7 @@ func TestAccResourceRedisCloudEssentialsSubscription_Paid_CreditCard_CRUDI(t *te const resourceName = "rediscloud_essentials_subscription.example" const datasourceName = "data.rediscloud_essentials_subscription.example" - resource.ParallelTest(t, resource.TestCase{ + resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, ProviderFactories: providerFactories, CheckDestroy: testAccCheckEssentialsSubscriptionDestroy, @@ -157,7 +157,7 @@ func TestAccResourceRedisCloudEssentialsSubscription_Paid_NoPaymentType_CRUDI(t const resourceName = "rediscloud_essentials_subscription.example" const datasourceName = "data.rediscloud_essentials_subscription.example" - resource.ParallelTest(t, resource.TestCase{ + resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, ProviderFactories: providerFactories, CheckDestroy: testAccCheckEssentialsSubscriptionDestroy, @@ -228,7 +228,7 @@ func TestAccResourceRedisCloudEssentialsSubscription_Paid_Marketplace_CRUDI(t *t const resourceName = "rediscloud_essentials_subscription.example" const datasourceName = "data.rediscloud_essentials_subscription.example" - resource.ParallelTest(t, resource.TestCase{ + resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, ProviderFactories: providerFactories, CheckDestroy: testAccCheckEssentialsSubscriptionDestroy, diff --git a/provider/resource_rediscloud_active_active_database.go b/provider/resource_rediscloud_active_active_database.go index 1776278a..bdac1505 100644 --- a/provider/resource_rediscloud_active_active_database.go +++ b/provider/resource_rediscloud_active_active_database.go @@ -2,6 +2,7 @@ package provider import ( "context" + "github.com/RedisLabs/terraform-provider-rediscloud/provider/utils" "log" "regexp" "strings" @@ -97,6 +98,13 @@ func resourceRedisCloudActiveActiveDatabase() *schema.Resource { Computed: true, ExactlyOneOf: []string{"memory_limit_in_gb", "dataset_size_in_gb"}, }, + "redis_version": { + Description: "Defines the Redis database version. If omitted, the Redis version will be set to the default version", + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + }, "support_oss_cluster_api": { Description: "Support Redis open-source (OSS) Cluster API", Type: schema.TypeBool, @@ -339,11 +347,7 @@ func resourceRedisCloudActiveActiveDatabaseCreate(ctx context.Context, d *schema name := d.Get("name").(string) supportOSSClusterAPI := d.Get("support_oss_cluster_api").(bool) useExternalEndpointForOSSClusterAPI := d.Get("external_endpoint_for_oss_cluster_api").(bool) - dataEviction := d.Get("data_eviction").(string) - globalDataPersistence := d.Get("global_data_persistence").(string) - globalPassword := d.Get("global_password").(string) globalSourceIp := setToStringSlice(d.Get("global_source_ips").(*schema.Set)) - respVersion := d.Get("global_resp_version").(string) createAlerts := make([]*databases.Alert, 0) alerts := d.Get("global_alert").(*schema.Set) @@ -399,33 +403,37 @@ func resourceRedisCloudActiveActiveDatabaseCreate(ctx context.Context, d *schema LocalThroughputMeasurement: localThroughputs, } - if dataEviction != "" { - createDatabase.DataEvictionPolicy = redis.String(dataEviction) - } + utils.SetStringIfNotEmpty(d, "data_eviction", func(s *string) { + createDatabase.DataEvictionPolicy = s + }) - if globalDataPersistence != "" { - createDatabase.GlobalDataPersistence = redis.String(globalDataPersistence) - } + utils.SetStringIfNotEmpty(d, "global_data_persistence", func(s *string) { + createDatabase.GlobalDataPersistence = s + }) - if globalPassword != "" { - createDatabase.GlobalPassword = redis.String(globalPassword) - } + utils.SetStringIfNotEmpty(d, "global_password", func(s *string) { + createDatabase.GlobalPassword = s + }) - if v, ok := d.GetOk("dataset_size_in_gb"); ok { - createDatabase.DatasetSizeInGB = redis.Float64(v.(float64)) - } + utils.SetFloat64(d, "dataset_size_in_gb", func(f *float64) { + createDatabase.DatasetSizeInGB = f + }) - if v, ok := d.GetOk("memory_limit_in_gb"); ok { - createDatabase.MemoryLimitInGB = redis.Float64(v.(float64)) - } + utils.SetFloat64(d, "memory_limit_in_gb", func(f *float64) { + createDatabase.MemoryLimitInGB = f + }) - if v, ok := d.GetOk("port"); ok { - createDatabase.PortNumber = redis.Int(v.(int)) - } + utils.SetIntIfPositive(d, "port", func(i *int) { + createDatabase.PortNumber = i + }) - if respVersion != "" { - createDatabase.RespVersion = redis.String(respVersion) - } + utils.SetStringIfNotEmpty(d, "global_resp_version", func(s *string) { + createDatabase.RespVersion = s + }) + + utils.SetStringIfNotEmpty(d, "redis_version", func(s *string) { + createDatabase.RedisVersion = s + }) // Confirm Subscription Active status before creating database err = waitForSubscriptionToBeActive(ctx, subId, api) @@ -591,6 +599,10 @@ func resourceRedisCloudActiveActiveDatabaseRead(ctx context.Context, d *schema.R return diag.FromErr(err) } + if err := d.Set("redis_version", redis.StringValue(db.RedisVersion)); err != nil { + return diag.FromErr(err) + } + tlsAuthEnabled := *db.CrdbDatabases[0].Security.TLSClientAuthentication if err := applyCertificateHints(tlsAuthEnabled, d); err != nil { return diag.FromErr(err) diff --git a/provider/resource_rediscloud_essentials_database_test.go b/provider/resource_rediscloud_essentials_database_test.go index 27ea93b1..d28e6d36 100644 --- a/provider/resource_rediscloud_essentials_database_test.go +++ b/provider/resource_rediscloud_essentials_database_test.go @@ -19,7 +19,7 @@ func TestAccResourceRedisCloudEssentialsDatabase_CRUDI(t *testing.T) { const resourceName = "rediscloud_essentials_database.example" const datasourceName = "data.rediscloud_essentials_database.example" - resource.ParallelTest(t, resource.TestCase{ + resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, ProviderFactories: providerFactories, CheckDestroy: testAccCheckEssentialsSubscriptionDestroy, @@ -276,7 +276,7 @@ func TestAccResourceRedisCloudEssentialsDatabase_DisableDefaultUser(t *testing.T const resourceName = "rediscloud_essentials_database.example" const datasourceName = "data.rediscloud_essentials_database.example" - resource.ParallelTest(t, resource.TestCase{ + resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, ProviderFactories: providerFactories, CheckDestroy: testAccCheckEssentialsSubscriptionDestroy, diff --git a/provider/resource_rediscloud_pro_database.go b/provider/resource_rediscloud_pro_database.go index a6d959ad..c397a0f5 100644 --- a/provider/resource_rediscloud_pro_database.go +++ b/provider/resource_rediscloud_pro_database.go @@ -3,6 +3,8 @@ package provider import ( "context" "fmt" + "github.com/RedisLabs/terraform-provider-rediscloud/provider/utils" + "log" "regexp" "strconv" "strings" @@ -92,6 +94,12 @@ func resourceRedisCloudProDatabase() *schema.Resource { Computed: true, ExactlyOneOf: []string{"memory_limit_in_gb", "dataset_size_in_gb"}, }, + "redis_version": { + Description: "Defines the Redis database version. If omitted, the Redis version will be set to the default version", + Type: schema.TypeString, + Optional: true, + Computed: true, + }, "support_oss_cluster_api": { Description: "Support Redis open-source (OSS) Cluster API", Type: schema.TypeBool, @@ -346,23 +354,9 @@ func resourceRedisCloudProDatabase() *schema.Resource { func resourceRedisCloudProDatabaseCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { api := meta.(*apiClient) - subId := d.Get("subscription_id").(int) - + subId := *utils.GetInt(d, "subscription_id") subscriptionMutex.Lock(subId) - name := d.Get("name").(string) - protocol := d.Get("protocol").(string) - supportOSSClusterAPI := d.Get("support_oss_cluster_api").(bool) - respVersion := d.Get("resp_version").(string) - dataPersistence := d.Get("data_persistence").(string) - dataEviction := d.Get("data_eviction").(string) - password := d.Get("password").(string) - replication := d.Get("replication").(bool) - throughputMeasurementBy := d.Get("throughput_measurement_by").(string) - throughputMeasurementValue := d.Get("throughput_measurement_value").(int) - averageItemSizeInBytes := d.Get("average_item_size_in_bytes").(int) - queryPerformanceFactor := d.Get("query_performance_factor").(string) - createModules := make([]*databases.Module, 0) modules := d.Get("modules").(*schema.Set) for _, module := range modules.List() { @@ -394,48 +388,52 @@ func resourceRedisCloudProDatabaseCreate(ctx context.Context, d *schema.Resource } createDatabase := databases.CreateDatabase{ - Name: redis.String(name), - Protocol: redis.String(protocol), - SupportOSSClusterAPI: redis.Bool(supportOSSClusterAPI), - DataPersistence: redis.String(dataPersistence), - DataEvictionPolicy: redis.String(dataEviction), - Replication: redis.Bool(replication), + Name: utils.GetString(d, "name"), + Protocol: utils.GetString(d, "protocol"), + SupportOSSClusterAPI: utils.GetBool(d, "support_oss_cluster_api"), + DataPersistence: utils.GetString(d, "data_persistence"), + DataEvictionPolicy: utils.GetString(d, "data_eviction"), + Replication: utils.GetBool(d, "replication"), ThroughputMeasurement: &databases.CreateThroughputMeasurement{ - By: redis.String(throughputMeasurementBy), - Value: redis.Int(throughputMeasurementValue), + By: utils.GetString(d, "throughput_measurement_by"), + Value: utils.GetInt(d, "throughput_measurement_value"), }, Modules: createModules, Alerts: createAlerts, RemoteBackup: buildBackupPlan(d.Get("remote_backup").([]interface{}), d.Get("periodic_backup_path")), } - if queryPerformanceFactor != "" { - createDatabase.QueryPerformanceFactor = redis.String(queryPerformanceFactor) - } + utils.SetStringIfNotEmpty(d, "query_performance_factor", func(s *string) { + createDatabase.QueryPerformanceFactor = s + }) - if password != "" { - createDatabase.Password = redis.String(password) - } + utils.SetStringIfNotEmpty(d, "redis_version", func(s *string) { + createDatabase.RedisVersion = s + }) - if averageItemSizeInBytes > 0 { - createDatabase.AverageItemSizeInBytes = &averageItemSizeInBytes - } + utils.SetStringIfNotEmpty(d, "password", func(s *string) { + createDatabase.Password = s + }) - if v, ok := d.GetOk("dataset_size_in_gb"); ok { - createDatabase.DatasetSizeInGB = redis.Float64(v.(float64)) - } + utils.SetIntIfPositive(d, "average_item_size_in_bytes", func(i *int) { + createDatabase.AverageItemSizeInBytes = i + }) - if v, ok := d.GetOk("memory_limit_in_gb"); ok { - createDatabase.MemoryLimitInGB = redis.Float64(v.(float64)) - } + utils.SetFloat64(d, "dataset_size_in_gb", func(f *float64) { + createDatabase.DatasetSizeInGB = f + }) - if v, ok := d.GetOk("port"); ok { - createDatabase.PortNumber = redis.Int(v.(int)) - } + utils.SetFloat64(d, "memory_limit_in_gb", func(f *float64) { + createDatabase.MemoryLimitInGB = f + }) - if respVersion != "" { - createDatabase.RespVersion = redis.String(respVersion) - } + utils.SetInt(d, "port", func(i *int) { + createDatabase.PortNumber = i + }) + + utils.SetStringIfNotEmpty(d, "resp_version", func(s *string) { + createDatabase.RespVersion = s + }) // Confirm sub is ready to accept a db request if err := waitForSubscriptionToBeActive(ctx, subId, api); err != nil { @@ -542,6 +540,10 @@ func resourceRedisCloudProDatabaseRead(ctx context.Context, d *schema.ResourceDa return diag.FromErr(err) } + if err := d.Set("redis_version", redis.StringValue(db.RedisVersion)); err != nil { + return diag.FromErr(err) + } + if err := d.Set("modules", flattenModules(db.Modules)); err != nil { return diag.FromErr(err) } @@ -687,19 +689,20 @@ func resourceRedisCloudProDatabaseUpdate(ctx context.Context, d *schema.Resource } update := databases.UpdateDatabase{ - Name: redis.String(d.Get("name").(string)), - SupportOSSClusterAPI: redis.Bool(d.Get("support_oss_cluster_api").(bool)), - Replication: redis.Bool(d.Get("replication").(bool)), + Name: utils.GetString(d, "name"), + SupportOSSClusterAPI: utils.GetBool(d, "support_oss_cluster_api"), + Replication: utils.GetBool(d, "replication"), ThroughputMeasurement: &databases.UpdateThroughputMeasurement{ - By: redis.String(d.Get("throughput_measurement_by").(string)), - Value: redis.Int(d.Get("throughput_measurement_value").(int)), + By: utils.GetString(d, "throughput_measurement_by"), + Value: utils.GetInt(d, "throughput_measurement_value"), }, - DataPersistence: redis.String(d.Get("data_persistence").(string)), - DataEvictionPolicy: redis.String(d.Get("data_eviction").(string)), + + DataPersistence: utils.GetString(d, "data_persistence"), + DataEvictionPolicy: utils.GetString(d, "data_eviction"), SourceIP: setToStringSlice(d.Get("source_ips").(*schema.Set)), Alerts: &alerts, RemoteBackup: buildBackupPlan(d.Get("remote_backup").([]interface{}), d.Get("periodic_backup_path")), - EnableDefaultUser: redis.Bool(d.Get("enable_default_user").(bool)), + EnableDefaultUser: utils.GetBool(d, "enable_default_user"), } // One of the following fields must be set, validation is handled in the schema (ExactlyOneOf) @@ -783,6 +786,25 @@ func resourceRedisCloudProDatabaseUpdate(ctx context.Context, d *schema.Resource return diag.FromErr(err) } + // if redis_version has changed, then upgrade first + if d.HasChange("redis_version") { + // if we have just created the database, it will detect an upgrade unnecessarily + originalVersion, newVersion := d.GetChange("redis_version") + + // if either version is blank, it could attempt to upgrade unnecessarily. + // only upgrade when a known version goes to another known version + if originalVersion.(string) != "" && newVersion.(string) != "" { + if diags, unlocked := upgradeRedisVersion(ctx, api, subId, dbId, newVersion.(string)); diags != nil { + if !unlocked { + subscriptionMutex.Unlock(subId) + } + return diags + } + } + } + + // Confirm db + sub active status + if err := api.client.Database.Update(ctx, subId, dbId, update); err != nil { subscriptionMutex.Unlock(subId) return diag.FromErr(err) @@ -807,6 +829,29 @@ func resourceRedisCloudProDatabaseUpdate(ctx context.Context, d *schema.Resource return resourceRedisCloudProDatabaseRead(ctx, d, meta) } +func upgradeRedisVersion(ctx context.Context, api *apiClient, subId int, dbId int, newVersion string) (diag.Diagnostics, bool) { + log.Printf("[INFO] Requesting Redis version change to %s...", newVersion) + + upgrade := databases.UpgradeRedisVersion{ + TargetRedisVersion: redis.String(newVersion), + } + + if err := api.client.Database.UpgradeRedisVersion(ctx, subId, dbId, upgrade); err != nil { + subscriptionMutex.Unlock(subId) + return diag.Errorf("failed to change Redis version to %s: %v", newVersion, err), true + } + + log.Printf("[INFO] Redis version change request to %s accepted by API", newVersion) + + // wait for upgrade + if err := waitForDatabaseToBeActive(ctx, subId, dbId, api); err != nil { + subscriptionMutex.Unlock(subId) + return diag.FromErr(err), true + } + + return nil, false +} + func buildBackupPlan(data interface{}, periodicBackupPath interface{}) *databases.DatabaseBackupConfig { var d map[string]interface{} diff --git a/provider/resource_rediscloud_pro_database_test.go b/provider/resource_rediscloud_pro_database_test.go index b7250b2d..c0caf218 100644 --- a/provider/resource_rediscloud_pro_database_test.go +++ b/provider/resource_rediscloud_pro_database_test.go @@ -14,7 +14,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) -// Checks CRUDI (CREATE,READ,UPDATE,IMPORT) operations on the database resource. +// Checks CRUDI (CREATE, READ, UPDATE, IMPORT) operations on the database resource. func TestAccResourceRedisCloudProDatabase_CRUDI(t *testing.T) { testAccRequiresEnvVar(t, "EXECUTE_TESTS") @@ -58,6 +58,7 @@ func TestAccResourceRedisCloudProDatabase_CRUDI(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "modules.#", "1"), resource.TestCheckResourceAttr(resourceName, "modules.0.name", "RedisBloom"), resource.TestCheckResourceAttr(resourceName, "enable_default_user", "true"), + resource.TestCheckResourceAttr(resourceName, "redis_version", "7.2"), resource.TestCheckResourceAttr(resourceName, "tags.market", "emea"), resource.TestCheckResourceAttr(resourceName, "tags.material", "cardboard"), @@ -125,6 +126,7 @@ func TestAccResourceRedisCloudProDatabase_CRUDI(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "modules.#", "1"), resource.TestCheckResourceAttr(resourceName, "modules.0.name", "RedisBloom"), resource.TestCheckResourceAttr(resourceName, "enable_default_user", "true"), + resource.TestCheckResourceAttr(resourceName, "redis_version", "7.2"), ), }, // Test that alerts are deleted @@ -376,6 +378,7 @@ resource "rediscloud_subscription_database" "example" { client_ssl_certificate = "" periodic_backup_path = "" enable_default_user = true + redis_version = 7.2 alert { name = "dataset-size" @@ -467,6 +470,7 @@ resource "rediscloud_subscription_database" "example" { replication = true average_item_size_in_bytes = 0 enable_default_user = true + redis_version = 7.2 alert { name = "dataset-size" diff --git a/provider/resource_rediscloud_pro_database_upgrade_test.go b/provider/resource_rediscloud_pro_database_upgrade_test.go new file mode 100644 index 00000000..fb276478 --- /dev/null +++ b/provider/resource_rediscloud_pro_database_upgrade_test.go @@ -0,0 +1,55 @@ +package provider + +import ( + "fmt" + "os" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" +) + +func TestAccResourceRedisCloudProDatabase_Upgrade(t *testing.T) { + + testAccRequiresEnvVar(t, "EXECUTE_TESTS") + + const resourceName = "rediscloud_subscription_database.example" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t); testAccAwsPreExistingCloudAccountPreCheck(t) }, + ProviderFactories: providerFactories, + CheckDestroy: testAccCheckProSubscriptionDestroy, + Steps: []resource.TestStep{ + // Test database and replica database creation + { + Config: getRedisCloudUpgradeConfig(t, "7.2"), + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr(resourceName, "name", "example"), + resource.TestCheckResourceAttr(resourceName, "protocol", "redis"), + resource.TestCheckResourceAttr(resourceName, "redis_version", "7.2"), + ), + }, + // Test database is updated successfully + { + Config: getRedisCloudUpgradeConfig(t, "7.4"), + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr(resourceName, "name", "example"), + resource.TestCheckResourceAttr(resourceName, "protocol", "redis"), + resource.TestCheckResourceAttr(resourceName, "redis_version", "7.4"), + ), + }, + }, + }) +} + +func getRedisCloudUpgradeConfig(t *testing.T, redisVersion string) string { + testCloudAccountName := os.Getenv("AWS_TEST_CLOUD_ACCOUNT_NAME") + name := acctest.RandomWithPrefix(testResourcePrefix) + + content, err := os.ReadFile("./testdata/testAccResourceRedisCloudProDatabaseUpgrade.tf") + if err != nil { + t.Fatalf("failed to read file: %v", err) + } + + return fmt.Sprintf(string(content), testCloudAccountName, name, redisVersion) +} diff --git a/provider/resource_rediscloud_pro_subscription.go b/provider/resource_rediscloud_pro_subscription.go index c528e61d..0d3e1cb0 100644 --- a/provider/resource_rediscloud_pro_subscription.go +++ b/provider/resource_rediscloud_pro_subscription.go @@ -363,6 +363,7 @@ func resourceRedisCloudProSubscription() *schema.Resource { Type: schema.TypeString, Optional: true, ForceNew: true, + Deprecated: "This attribute is deprecated on pro subscriptions. Please specify `redis_version` on databases directly instead.", DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { if d.Id() == "" { // Consider the property if the resource is about to be created. @@ -1228,6 +1229,7 @@ func waitForDatabaseToBeActive(ctx context.Context, subId, id int, api *apiClien databases.StatusProxyPolicyChangePending, databases.StatusProxyPolicyChangeDraft, databases.StatusDynamicEndpointsCreationPending, + databases.StatusActiveUpgradePending, }, Target: []string{databases.StatusActive}, Timeout: safetyTimeout, diff --git a/provider/testdata/testAccDatasourceRedisCloudProDatabase.tf b/provider/testdata/testAccDatasourceRedisCloudProDatabase.tf new file mode 100644 index 00000000..12abc849 --- /dev/null +++ b/provider/testdata/testAccDatasourceRedisCloudProDatabase.tf @@ -0,0 +1,70 @@ +locals { + rediscloud_cloud_account = "%s" + rediscloud_subscription_name = "%s" + rediscloud_password = "%s" +} + +data "rediscloud_payment_method" "card" { + card_type = "Visa" + last_four_numbers = "5556" +} + +data "rediscloud_cloud_account" "account" { + exclude_internal_account = true + provider_type = "AWS" + name = local.rediscloud_cloud_account +} +resource "rediscloud_subscription" "example" { + name = local.rediscloud_subscription_name + payment_method_id = data.rediscloud_payment_method.card.id + memory_storage = "ram" + cloud_provider { + provider = data.rediscloud_cloud_account.account.provider_type + cloud_account_id = data.rediscloud_cloud_account.account.id + region { + region = "eu-west-1" + networking_deployment_cidr = "10.0.0.0/24" + preferred_availability_zones = ["eu-west-1a"] + } + } + creation_plan { + memory_limit_in_gb = 1 + quantity = 1 + replication=false + support_oss_cluster_api=true + throughput_measurement_by = "operations-per-second" + throughput_measurement_value = 1000 + query_performance_factor = "2x" + modules = ["RediSearch"] + } +} +resource "rediscloud_subscription_database" "example" { + subscription_id = rediscloud_subscription.example.id + name = "tf-database" + protocol = "redis" + memory_limit_in_gb = 1 + data_persistence = "none" + throughput_measurement_by = "operations-per-second" + throughput_measurement_value = 1000 + password = local.rediscloud_password + support_oss_cluster_api = true + replication = false + enable_default_user = true + query_performance_factor = "2x" + redis_version = "7.2" + modules = [ + { + name: "RediSearch" + } + ] +} + +data "rediscloud_database" "example-by-id" { + subscription_id = rediscloud_subscription.example.id + db_id = rediscloud_subscription_database.example.db_id +} + +data "rediscloud_database" "example-by-name" { + subscription_id = rediscloud_subscription.example.id + name = rediscloud_subscription_database.example.name +} diff --git a/provider/testdata/testAccResourceRedisCloudProDatabaseUpgrade.tf b/provider/testdata/testAccResourceRedisCloudProDatabaseUpgrade.tf new file mode 100644 index 00000000..c872dca0 --- /dev/null +++ b/provider/testdata/testAccResourceRedisCloudProDatabaseUpgrade.tf @@ -0,0 +1,76 @@ +locals { + rediscloud_cloud_account = "%s" + rediscloud_subscription_name = "%s" + redis_version = "%s" +} + +data "rediscloud_payment_method" "card" { + card_type = "Visa" + last_four_numbers = "5556" +} + +data "rediscloud_cloud_account" "account" { + exclude_internal_account = true + provider_type = "AWS" + name = local.rediscloud_cloud_account +} + +resource "rediscloud_subscription" "example" { + name = local.rediscloud_subscription_name + payment_method_id = data.rediscloud_payment_method.card.id + memory_storage = "ram" + + allowlist { + cidrs = ["192.168.0.0/16"] + security_group_ids = [] + } + + cloud_provider { + provider = data.rediscloud_cloud_account.account.provider_type + cloud_account_id = data.rediscloud_cloud_account.account.id + region { + region = "eu-west-1" + networking_deployment_cidr = "10.0.0.0/24" + preferred_availability_zones = ["eu-west-1a"] + } + } + + creation_plan { + dataset_size_in_gb = 1 + throughput_measurement_by = "operations-per-second" + throughput_measurement_value = 1000 + quantity = 1 + replication=false + support_oss_cluster_api=false + modules = [] + } +} + +resource "rediscloud_subscription_database" "example" { + subscription_id = rediscloud_subscription.example.id + name = "example" + protocol = "redis" + dataset_size_in_gb = 3 + data_persistence = "none" + data_eviction = "allkeys-random" + throughput_measurement_by = "operations-per-second" + throughput_measurement_value = 1000 + support_oss_cluster_api = false + external_endpoint_for_oss_cluster_api = false + replication = false + average_item_size_in_bytes = 0 + client_ssl_certificate = "" + periodic_backup_path = "" + enable_default_user = true + redis_version = local.redis_version + + alert { + name = "dataset-size" + value = 1 + } + + tags = { + "market" = "emea" + "material" = "cardboard" + } +} diff --git a/provider/utils/utils.go b/provider/utils/utils.go new file mode 100644 index 00000000..13a7417e --- /dev/null +++ b/provider/utils/utils.go @@ -0,0 +1,70 @@ +package utils + +import ( + "github.com/RedisLabs/rediscloud-go-api/redis" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" +) + +// GetString safely retrieves a string value from schema.ResourceData. +func GetString(d *schema.ResourceData, key string) *string { + if v, ok := d.GetOk(key); ok { + return redis.String(v.(string)) + } + return redis.String("") +} + +// GetBool safely retrieves a bool value from schema.ResourceData. +func GetBool(d *schema.ResourceData, key string) *bool { + if v, ok := d.GetOk(key); ok { + return redis.Bool(v.(bool)) + } + return redis.Bool(false) +} + +// GetInt safely retrieves an int value from schema.ResourceData. +func GetInt(d *schema.ResourceData, key string) *int { + if v, ok := d.GetOk(key); ok { + return redis.Int(v.(int)) + } + return redis.Int(0) +} + +func SetStringIfNotEmpty(d *schema.ResourceData, key string, setter func(*string)) { + if v, ok := d.GetOk(key); ok { + if s, valid := v.(string); valid && s != "" { + setter(redis.String(s)) + } + } +} + +func SetIntIfPositive(d *schema.ResourceData, key string, setter func(*int)) { + if v, ok := d.GetOk(key); ok { + if i, valid := v.(int); valid && i > 0 { + setter(redis.Int(i)) + } + } +} + +func SetInt(d *schema.ResourceData, key string, setter func(*int)) { + if v, ok := d.GetOk(key); ok { + if i, valid := v.(int); valid { + setter(redis.Int(i)) + } + } +} + +func SetFloat64(d *schema.ResourceData, key string, setter func(*float64)) { + if v, ok := d.GetOk(key); ok { + if f, valid := v.(float64); valid { + setter(redis.Float64(f)) + } + } +} + +func SetBool(d *schema.ResourceData, key string, setter func(*bool)) { + if v, ok := d.GetOk(key); ok { + if b, valid := v.(bool); valid { + setter(redis.Bool(b)) + } + } +}