The Redis Enterprise Cloud Terraform provider is a plugin for Terraform that allows Redis Enterprise Cloud Flexible customers to manage the full lifecyle of their subscriptions and related Redis databases.
To use the Redis Enterprise Cloud Terraform provider you will need to set the following environment variables, and these are created through the Redis Enterprise Cloud console under the settings menu.
- REDISCLOUD_ACCESS_KEY - Account Cloud API Access Key
- REDISCLOUD_SECRET_KEY - Individual user Cloud API Secret Key
If you wish to work on the provider, you'll first need Go installed on your machine (see Requirements above). You will also need to create or have access to a Redis Cloud Enterprise account.
- Clone the repository
- Enter the repository directory
- Build the provider using the
make build
command:
$ make build
The make build
command will build a local provider binary into a bin
directory at the root of the repository.
After the provider has been built locally it must be placed in the user plugins directory so it can be discovered by the
Terraform CLI. The default user plugins directory root is ~/.terraform.d/plugins
.
Use the following make command to install the provider locally.
$ make install_local
The provider will now be installed in the following location ready to be used by Terraform
~/.terraform.d/plugins
└── registry.terraform.io
└── RedisLabs
└── rediscloud
└── 99.99.99
└── <OS>_<ARCH>
└── terraform-provider-rediscloud_v99.99.99
The provider binary is built using a version number of 99.99.99
and this will allow terraform to use the locally
built provider over a released version.
The terraform provider is installed and can now be discovered by Terraform through the following HCL block.
terraform {
required_providers {
rediscloud = {
source = "RedisLabs/rediscloud"
}
}
required_version = ">= 0.13"
}
The following is an example of using the rediscloud_regions data-source to discover a list of supported regions. It can be used to verify that the provider is setup and installed correctly without incurring the cost of subscriptions and databases.
data "rediscloud_regions" "example" {
}
output "all_regions" {
value = data.rediscloud_regions.example.regions
}
In order to run the full suite of Acceptance tests, run make testacc
.
Note: Acceptance tests create real resources, and often cost money to run.
$ make testacc
This provider uses Go modules. Please see the Go documentation for the most up to date information about using Go modules.
To add a new dependency github.com/author/dependency
to your Terraform provider:
go get github.com/author/dependency
go mod tidy
Then commit the changes to go.mod
and go.sum
.