Terraform provider
The CCX Terraform provider allows to create datastores on all supported clouds. The CCX Terraform provider project is hosted on github.
Oauth2 credentials
Oauth2 credentials are used to authenticate the CCX Terraform provider with CCX.
You can generate these credentials on the Account page Authorization tab.
And then you will see:
Terraform provider
Requirement
- Terraform 0.13.x or later
Quick Start
- Create Oauth2 credentials.
- Create a
terraform.tf
- Set
client_id
,client_secret
, below is a terraform.tf file:
terraform {
required_providers {
ccx = {
source = "severalnines/ccx"
version = "~> 0.3.1"
}
}
}
provider "ccx" {
client_id = `client_id`
client_secret = `client_secret`
}
Now, you can create a datastore using the following terraform code.
Here is an example of a parameter group:
``` terraform
resource "ccx_parameter_group" "asteroid" {
name = "asteroid"
database_vendor = "mariadb"
database_version = "10.11"
database_type = "galera"
parameters = {
table_open_cache = 8000
sql_mode = "STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
}
}
This group can then be associated with a datastore as follows:
resource "ccx_datastore" "luna_mysql" {
name = "luna_mysql"
size = 3
type = "replication"
db_vendor = "mysql"
tags = ["new", "test"]
cloud_provider = "CCX_CLOUD"
cloud_region = "CCX-REGION-1"
instance_size = "MEGALARGE"
volume_size = 80
volume_type = "MEGAFAST"
parameter_group = ccx_parameter_group.asteroid.id
}
Replace CCX_CLOUD, CCX-REGION-1, MEGALARGE and, MEGAFAST, with actual values depending on the cloud infrastructure available.
For more information visit the terraform-provider-ccx github page.