1
GitHub - Percona-Lab/terraform-provider-percona: Terraform modules to deploy Per...
source link: https://github.com/Percona-Lab/terraform-provider-percona
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Percona Terraform Provider
DISCLAIMER
This is an experimental project, use on your own risk. This project is not covered by Percona Support
Requirements
How to run on AWS
- Clone repo
- Configure AWS CLI - tutorial
- Switch to project directory
- Execute in console
make all
or go through Makefile(in the root of project) manually - When cluster is set up, connect to one of the PXC instances
- Login to mysql with command
sudo mysql -uroot -p
and enter passwordpassword
- Check cluster status
show status like 'wsrep%';
- Connect to one of the Percona Server replica
- Check replication status using
SHOW SLAVE STATUS\G
on replica
How to run on Google Cloud Platform
- Create service account in Google Cloud Console and create key for it (for more info, visit https://cloud.google.com/docs/authentication/getting-started)
- Export
GOOGLE_APPLICATION_CREDENTIALS
environment variable to point to the file with credentials (e.g.export GOOGLE_APPLICATION_CREDENTIALS=/path/to/credentials.json
) - Execute
make all
Configuration
File main.tf
# AWS provider configuration
provider "percona" {
region = "eu-north-1" # required
profile = "default" # optional
cloud = "aws" # required, supported values: "aws", "gcp"
ignore_errors_on_destroy = true # optional, default: false
}
# GCP provider configuration
#provider "percona" {
# region = "europe-west1"
# zone = "europe-west1-c"
# project = "project-name"
# cloud = "gcp"
# ignore_errors_on_destroy = false
#}
resource "percona_ps" "ps" {
instance_type = "t3.micro" # required
key_pair_name = "sshKey1" # required
password = "password" # optional, default: "password"
replica_password = "replicaPassword" # optional, default: "replicaPassword"
cluster_size = 2 # optional, default: 3
path_to_key_pair_storage = "/tmp/" # optional, default: "."
volume_type = "gp2" # optional, default: "gp2" for AWS, "pd-balanced" for GCP
volume_size = 20 # optional, default: 20
volume_iops = 4000 # optional
config_file_path = "./config.cnf" # optional, saves config file to /etc/mysql/mysql.conf.d/custom.cnf
version = "8.0.28" # optional, installs last version if not specified
myrocks_install = true # optional, default: false
vpc_name = "percona_vpc_1" # optional
}
resource "percona_pxc" "pxc" {
instance_type = "t3.micro" # required
key_pair_name = "sshKey2" # required
password = "password" # optional, default: "password"
cluster_size = 2 # optional, default: 3
path_to_key_pair_storage = "/tmp/" # optional, default: "."
volume_type = "gp2" # optional, default: "gp2" for AWS, "pd-balanced" for GCP
volume_size = 20 # optional, default: 20
volume_iops = 4000 # optional
config_file_path = "./config.cnf" # optional, saves config file to /etc/mysql/mysql.conf.d/custom.cnf
version = "8.0.28" # optional, installs last version if not specified
vpc_name = "percona_vpc_1" # optional
}
File version.tf
terraform {
required_providers {
percona = {
version = "~> 0.9.0"
source = "terraform-percona.com/terraform-percona/percona"
}
}
}
Required permissions
For AWS
Instance types, in some regions some may be available and in others they may not.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK