Skip to content

Commit

Permalink
Document which parameters are ForceNew (#374)
Browse files Browse the repository at this point in the history
Add documentation for the end user to indicate which attributes will
cause a resource to be replaced rather than just updated.

Also update dependencies & GitHub actions to the latest version
  • Loading branch information
wjam authored May 19, 2023
1 parent ea5cfea commit 5d4ee5c
Show file tree
Hide file tree
Showing 21 changed files with 157 additions and 1,299 deletions.
90 changes: 13 additions & 77 deletions .github/workflows/terraform_provider.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,60 +14,28 @@ on:
paths-ignore:
- '**.md'
env:
GO_VERSION: "1.18"
TERRAFORM_VERSION: "1.2.6"

jobs:
go_mod_download:
name: go mod download
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- uses: actions/[email protected]
continue-on-error: true
id: cache-go-pkg-mod
timeout-minutes: 2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-pkg-mod-${{ hashFiles('go.sum') }}
- if: steps.cache-go-pkg-mod.outputs.cache-hit != 'true' || steps.cache-go-pkg-mod.outcome == 'failure'
run: go mod download

go_build:
name: go build
needs: [go_mod_download]
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: actions/cache@v3.0.5
- uses: actions/cache@v3.3.1
continue-on-error: true
id: cache-terraform-plugin-dir
timeout-minutes: 2
with:
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@v3
uses: actions/setup-go@v4.0.1
with:
go-version: ${{ env.GO_VERSION }}
# See also: https://github.com/actions/setup-go/issues/54
- if: steps.cache-terraform-plugin-dir.outputs.cache-hit != 'true' || steps.cache-terraform-plugin-dir.outcome == 'failure'
name: go env
run: |
echo "GOCACHE=$(go env GOCACHE)" >> $GITHUB_ENV
go-version-file: go.mod
- if: steps.cache-terraform-plugin-dir.outputs.cache-hit != 'true' || steps.cache-terraform-plugin-dir.outcome == 'failure'
uses: actions/[email protected]
with:
path: ${{ env.GOCACHE }}
key: ${{ runner.os }}-GOCACHE-${{ hashFiles('go.sum') }}-${{ hashFiles('provider/**') }}
- if: steps.cache-terraform-plugin-dir.outputs.cache-hit != 'true' || steps.cache-terraform-plugin-dir.outcome == 'failure'
uses: actions/[email protected]
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-pkg-mod-${{ hashFiles('go.sum') }}
name: go mod download
run: go mod download
- if: steps.cache-terraform-plugin-dir.outputs.cache-hit != 'true' || steps.cache-terraform-plugin-dir.outcome == 'failure'
name: go build
run: go build -o terraform-plugin-dir/registry.terraform.io/RedisLabs/rediscloud/99.99.99/$(go env GOOS)_$(go env GOARCH)/terraform-provider-rediscloud .
Expand All @@ -78,21 +46,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: actions/cache@v3.0.5
- uses: actions/cache@v3.3.1
continue-on-error: true
id: cache-terraform-providers-schema
timeout-minutes: 2
with:
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@v3.0.5
uses: actions/cache@v3.3.1
timeout-minutes: 2
with:
path: terraform-plugin-dir
key: ${{ runner.os }}-terraform-plugin-dir-${{ hashFiles('go.sum') }}-${{ hashFiles('provider/**') }}
- if: steps.cache-terraform-providers-schema.outputs.cache-hit != 'true' || steps.cache-terraform-providers-schema.outcome == 'failure'
uses: hashicorp/[email protected].0
uses: hashicorp/[email protected].3
with:
terraform_version: ${{ env.TERRAFORM_VERSION }}
terraform_wrapper: false
Expand Down Expand Up @@ -124,26 +92,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: actions/setup-go@v3
- uses: actions/setup-go@v4.0.1
with:
go-version: ${{ env.GO_VERSION }}
# See also: https://github.com/actions/setup-go/issues/54
- name: go env
run: |
echo "GOCACHE=$(go env GOCACHE)" >> $GITHUB_ENV
- uses: actions/[email protected]
continue-on-error: true
timeout-minutes: 2
with:
path: ${{ env.GOCACHE }}
key: ${{ runner.os }}-GOCACHE-${{ hashFiles('go.sum') }}-${{ hashFiles('provider/**') }}
- uses: actions/[email protected]
continue-on-error: true
timeout-minutes: 2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-pkg-mod-${{ hashFiles('go.sum') }}
- uses: dorny/[email protected]
go-version-file: go.mod
- uses: dorny/[email protected]
id: filter
with:
filters: |
Expand Down Expand Up @@ -182,23 +134,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
# See also: https://github.com/actions/setup-go/issues/54
- name: go env
run: |
echo "GOCACHE=$(go env GOCACHE)" >> $GITHUB_ENV
- uses: actions/[email protected]
continue-on-error: true
timeout-minutes: 2
with:
path: ${{ env.GOCACHE }}
key: ${{ runner.os }}-GOCACHE-${{ hashFiles('go.sum') }}-${{ hashFiles('provider/**') }}
- uses: actions/[email protected]
continue-on-error: true
timeout-minutes: 2
- uses: actions/[email protected]
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-pkg-mod-${{ hashFiles('go.sum') }}
go-version-file: go.mod
- run: make tfproviderlint
2 changes: 1 addition & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ builds:
flags:
- -trimpath
ldflags:
- '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}'
- '-s -w -X main.version={{.Version}}'
goos:
- freebsd
- windows
Expand Down
4 changes: 2 additions & 2 deletions docs/resources/rediscloud_active_active_subscription.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ resource "rediscloud_active_active_subscription" "subscription-resource" {
The following arguments are supported:

* `name` - (Required) A meaningful name to identify the subscription
* `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'
* `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'. **Modifying this attribute will force creation of a new resource.**
* `payment_method_id` - (Optional) A valid payment method pre-defined in the current account. This value is __Optional__ for AWS/GCP Marketplace accounts, but __Required__ for all other account types
* `cloud_provider` - (Optional) The cloud provider to use with the subscription, (either `AWS` or `GCP`). Default: ‘AWS’
* `cloud_provider` - (Optional) The cloud provider to use with the subscription, (either `AWS` or `GCP`). Default: ‘AWS’. **Modifying this attribute will force creation of a new resource.**
* `creation_plan` - (Required) A creation plan object, documented below

The `creation_plan` block supports:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
layout: "rediscloud"
page_title: "Redis Cloud: rediscloud_active_active_subscription_database"
description: |-
Database resource for Active-Active Subscriptions in the Terraform provider Redis Cloud.
Database resource for Active-Active Subscriptions in the Terraform provider Redis Cloud.
---

# Resource: rediscloud_active_active_subscription_database
Expand Down Expand Up @@ -79,8 +79,8 @@ output "us-east-2-private-endpoints" {
## Argument Reference

The following arguments are supported:
* `subscription_id`: (Required) The ID of the Active-Active subscription to create the database in
* `name` - (Required) A meaningful name to identify the database
* `subscription_id`: (Required) The ID of the Active-Active 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. **Modifying this attribute will force creation of a new resource.**
* `memory_limit_in_gb` - (Required) Maximum memory usage for this specific database, including replication and other overhead
* `support_oss_cluster_api` - (Optional) Support Redis open-source (OSS) Cluster API. Default: ‘false’
* `external_endpoint_for_oss_cluster_api` - (Optional) Should use the external endpoint for open-source (OSS) Cluster API.
Expand All @@ -92,7 +92,7 @@ The following arguments are supported:
* `global_password` - (Optional) Password to access the database of regions that don't override global settings. If left empty, the password will be generated automatically
* `global_alert` - (Optional) A block defining Redis database alert of regions that don't override global settings, documented below, can be specified multiple times
* `global_source_ips` - (Optional) List of source IP addresses or subnet masks of regions that don't override global settings. If specified, Redis clients will be able to connect to this database only from within the specified source IP addresses ranges (example: ['192.168.10.0/32', '192.168.12.0/24'])
* `port` - (Optional) TCP port on which the database is available - must be between 10000 and 19999.
* `port` - (Optional) TCP port on which the database is available - must be between 10000 and 19999. **Modifying this attribute will force creation of a new resource.**
* `override_region` - (Optional) Override region specific configuration, documented below


Expand Down
20 changes: 10 additions & 10 deletions docs/resources/rediscloud_active_active_subscription_peering.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,20 @@ resource "google_compute_network_peering" "gcp-peering-resource" {

The following arguments are supported:

* `provider_name` - (Optional) The cloud provider to use with the vpc peering, (either `AWS` or `GCP`). Default: ‘AWS’
* `subscription_id` - (Required) A valid Active-Active subscription predefined in the current account
* `provider_name` - (Optional) The cloud provider to use with the vpc peering, (either `AWS` or `GCP`). Default: ‘AWS’. **Modifying this attribute will force creation of a new resource.**
* `subscription_id` - (Required) A valid Active-Active subscription predefined in the current account. **Modifying this attribute will force creation of a new resource.**

**AWS ONLY:**
* `aws_account_id` - (Required) AWS account ID that the VPC to be peered lives in
* `source_region` - (Required) Name of the region to create the VPC peering from
* `destination_region` - (Required) Name of the region to create the VPC peering to
* `vpc_id` - (Required) Identifier of the VPC to be peered
* `vpc_cidr` - (Optional) CIDR range of the VPC to be peered. Either this or `vpc_cidrs` must be specified
* `vpc_cidrs` - (Optional) CIDR ranges of the VPC to be peered. Either this or `vpc_cidr` must be specified
* `aws_account_id` - (Required) AWS account ID that the VPC to be peered lives in. **Modifying this attribute will force creation of a new resource.**
* `source_region` - (Required) Name of the region to create the VPC peering from. **Modifying this attribute will force creation of a new resource.**
* `destination_region` - (Required) Name of the region to create the VPC peering to. **Modifying this attribute will force creation of a new resource.**
* `vpc_id` - (Required) Identifier of the VPC to be peered. **Modifying this attribute will force creation of a new resource.**
* `vpc_cidr` - (Optional) CIDR range of the VPC to be peered. Either this or `vpc_cidrs` must be specified. **Modifying this attribute will force creation of a new resource.**
* `vpc_cidrs` - (Optional) CIDR ranges of the VPC to be peered. Either this or `vpc_cidr` must be specified. **Modifying this attribute will force creation of a new resource.**

**GCP ONLY:**
* `gcp_project_id` - (Required) GCP project ID that the VPC to be peered lives in
* `gcp_network_name` - (Required) The name of the network to be peered
* `gcp_project_id` - (Required) GCP project ID that the VPC to be peered lives in. **Modifying this attribute will force creation of a new resource.**
* `gcp_network_name` - (Required) The name of the network to be peered. **Modifying this attribute will force creation of a new resource.**

### Timeouts

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ resource "rediscloud_active_active_subscription_regions" "regions-resource" {

The following arguments are supported:

* `subscription_id` - (Required) ID of the subscription that the regions belong to
* `subscription_id` - (Required) ID of the subscription that the regions belong to. **Modifying this attribute will force creation of a new resource.**
* `delete_regions` - (Optional) Flag required to be set when one or more regions is to be deleted, if the flag is not set an error will be thrown
* `region` - (Required) Cloud networking details, per region, documented below

Expand Down
6 changes: 3 additions & 3 deletions docs/resources/rediscloud_cloud_account.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ resource "rediscloud_subscription" "example" {
cloud_provider {
provider = data.rediscloud_cloud_account.example.provider_type
cloud_account_id = data.rediscloud_cloud_account.example.id
...
# ...
}
...
# ...
}
```
Expand All @@ -58,7 +58,7 @@ Note that drift cannot currently be detected for this.
* `name` - (Required) Display name of the account.

* `provider_type` - (Required) Cloud provider type - either `AWS` or `GCP`.
Note that drift cannot currently be detected for this.
Note that drift cannot currently be detected for this. **Modifying this attribute will force creation of a new resource.**

* `sign_in_login_url` - (Required) Cloud provider management console login URL.
Note that drift cannot currently be detected for this.
Expand Down
22 changes: 11 additions & 11 deletions docs/resources/rediscloud_subscription.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ resource "rediscloud_subscription" "subscription-resource" {
The following arguments are supported:

* `name` - (Required) A meaningful name to identify the subscription
* `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'
* `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'. **Modifying this attribute will force creation of a new resource.**
* `payment_method_id` - (Optional) A valid payment method pre-defined in the current account. This value is __Optional__ for AWS/GCP Marketplace accounts, but __Required__ for all other account types
* `memory_storage` - (Optional) Memory storage preference: either ‘ram’ or a combination of ‘ram-and-flash’. Default: ‘ram’
* `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.**
* `allowlist` - (Optional) An allowlist object, documented below
* `cloud_provider` - (Required) A cloud provider 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

The `allowlist` block supports:
Expand All @@ -75,11 +75,11 @@ The `allowlist` block supports:

The `cloud_provider` block supports:

* `provider` - (Optional) The cloud provider to use with the subscription, (either `AWS` or `GCP`). Default: ‘AWS’
* `cloud_account_id` - (Optional) Cloud account identifier. Default: Redis Labs internal cloud account
* `provider` - (Optional) The cloud provider to use with the subscription, (either `AWS` or `GCP`). Default: ‘AWS’. **Modifying this attribute will force creation of a new resource.**
* `cloud_account_id` - (Optional) Cloud account identifier. Default: Redis Labs internal cloud account. **Modifying this attribute will force creation of a new resource.**
(using Cloud Account ID = 1 implies using Redis Labs internal cloud account). Note that a GCP subscription can be created
only with Redis Labs internal cloud account
* `region` - (Required) A region object, documented below
* `region` - (Required) A region object, documented below. **Modifying this attribute will force creation of a new resource.**

The `creation_plan` block supports:

Expand All @@ -101,13 +101,13 @@ be the maximum average item size defined in one of your databases. Default: 100

The cloud_provider `region` block supports:

* `region` - (Required) Deployment region as defined by cloud provider
* `multiple_availability_zones` - (Optional) Support deployment on multiple availability zones within the selected region. Default: ‘false’
* `networking_deployment_cidr` - (Required) Deployment CIDR mask. The total number of bits must be 24 (x.x.x.x/24)
* `region` - (Required) Deployment region as defined by cloud provider. **Modifying this attribute will force creation of a new resource.**
* `multiple_availability_zones` - (Optional) Support deployment on multiple availability zones within the selected region. Default: ‘false’. **Modifying this attribute will force creation of a new resource.**
* `networking_deployment_cidr` - (Required) Deployment CIDR mask. The total number of bits must be 24 (x.x.x.x/24). **Modifying this attribute will force creation of a new resource.**
* `networking_vpc_id` - (Optional) Either an existing VPC Id (already exists in the specific region) or create a new VPC
(if no VPC is specified). VPC Identifier must be in a valid format (for example: ‘vpc-0125be68a4986384ad’) and existing
within the hosting account.
* `preferred_availability_zones` - (Optional) Availability zones deployment preferences (for the selected provider & region). If multiple_availability_zones is set to 'true', select three availability zones from the list. If you don't want to specify preferred availability zones, set this attribute to an empty list ('[]').
within the hosting account. **Modifying this attribute will force creation of a new resource.**
* `preferred_availability_zones` - (Optional) Availability zones deployment preferences (for the selected provider & region). If multiple_availability_zones is set to 'true', select three availability zones from the list. If you don't want to specify preferred availability zones, set this attribute to an empty list ('[]'). **Modifying this attribute will force creation of a new resource.**

~> **Note:** The preferred_availability_zones parameter is required for Terraform, but is optional within the Redis Enterprise Cloud UI.
This difference in behaviour is to guarantee that a plan after an apply does not generate differences. In AWS Redis internal cloud account, please set the zone IDs (for example: `["use-az2", "use-az3", "use-az5"]`).
Expand Down
Loading

0 comments on commit 5d4ee5c

Please sign in to comment.