The Cyral Terraform Provider contains resources that can be used to interact with the Cyral API through Terraform code. It allows customers to maintain a history of changes in Cyral environment by transforming configurations into code and use Terraform to control state changes.
Our provider uses the same naming conventions and organization as stated in Terraform guidelines for writing custom providers.
Full and comprehensive documentation for this provider is available on the provider documentation index.
The Change Log keeps track of features, bug fixes and Control Plane compatibility of this provider.
See below a list of guides that can be used to deploy some predefined scenarios:
In order to build this repository, follow the steps below:
-
Clone terraform-provider-cyral repo from GitHub;
-
Go to the root directory of the cloned repo using Linux shell and execute
make
. The build process will create binaries in directoryout
for bothdarwin
andlinux
64 bits. These binaries will be copied automatically to the local Terraform registry to be used by Terraform 13 and later.
Alternatively, you can use the dockerfile to build the image using make docker-compose/build
To use the local provider, the module must be configured to use the local provider path as follows:
terraform {
required_providers {
cyral = {
source = "local/terraform/cyral"
}
}
}
The test framework requires basic configuration before it can be executed as follows:
- Set the configuration environment variables:
# Set the control plane DNS name and port (default 8000):
export CYRAL_TF_CONTROL_PLANE=mycp.cyral.com:8000
# Set Keycloak client and secret ID:
export CYRAL_TF_CLIENT_ID=?
export CYRAL_TF_CLIENT_SECRET=?
# Initialize Terraform acceptance tests variable
export TF_ACC=true
- Run
make
This project uses pre-commit to automatically lint changes during the commit process.
Before committing a change, you will need to install pre-commit
and then install
the hooks by running the following command in the root of the repository:
pre-commit install
Copy the desired binary file created in directory out
(see Build Instructions) to the root folder containing those .tf
files that will be used to handle Cyral Terraform provider resources.
Run terraform init
and proceed with terraform apply
normally to execute your Terraform scripts.
Build the project using steps in Build Instructions, then proceed normally with terraform init
and terraform apply
commands.