shardingsphere.org
Step1: Edit main.tf
terraform { required_providers { aws = { source = "hashicorp/aws" version = "4.37.0" } } } provider "aws" { region = "ap-southeast-1" } module "zk" { source = "./modules/zk" cluster_size = 3 key_name = "test-tf" instance_type = "t2.nano" vpc_id = "vpc-0ef2b7440d3ade8d5" subnet_ids = ["subnet-0f388a6f23063b8c9", "subnet-0bc2cd85facb5ca06", "subnet-009077567350ef1b7"] security_groups = ["sg-008e74936b3f9de19"] } module "shardingsphere" { depends_on = [module.zk] source = "./modules/shardingsphere" cluster_size = 3 shardingsphere_version = "5.2.1" key_name = "test-tf" image_id = "ami-094bbd9e922dc515d" instance_type = "t3.medium" lb_listener_port = 3307 vpc_id = "vpc-0ef2b7440d3ade8d5" subnet_ids = ["subnet-0f388a6f23063b8c9", "subnet-0bc2cd85facb5ca06", "subnet-009077567350ef1b7"] security_groups = ["sg-008e74936b3f9de19"] zk_servers = module.zk.zk_node_domain }
Step2: Set environments for AK/SK
export AWS_ACCESS_KEY_ID="accesskey" export AWS_SECRET_ACCESS_KEY="secretkey"
Step3: Initial Terraform working directory
terrafrom init
Step4: Run the command terraform plan
to generates a execution plan. Step5: Run the command terraform apply
to crates your defined infrastructure.
By default, Terraform will create a domain proxy.[ZONE NAME]
is used by other services.
If you want to delete, you can run the command terraform destroy
, Terraform will destroy your defined infrastructure.
Name | Version |
---|---|
aws | 4.37.0 |
Name | Source | Version |
---|---|---|
zk | ./zk | n/a |
shardingsphere | ./shardingsphere | n/a |
Name | Description |
---|---|
shardingsphere_domain | The domain name of the ShardingSphere Proxy Cluster for use by other services |
zk_node_domain | The domain of zookeeper instances |
Name | Type |
---|---|
aws_instance.zk | resource |
aws_network_interface.zk | resource |
aws_route53_record.zk | resource |
aws_ami.base | data source |
aws_availability_zones.available | data source |
aws_route53_zone.zone | data source |
Name | Description | Type | Default | Required |
---|---|---|---|---|
cluster_size | The cluster size that same size as available_zones | number | n/a | yes |
hosted_zone_name | The name of the hosted private zone | string | "shardingsphere.org" | no |
instance_type | The EC2 instance type | string | n/a | yes |
key_name | The ssh keypair for remote connection | string | n/a | yes |
security_groups | List of the Security Group, it must be allow access 2181, 2888, 3888 port | list(string) | [] | no |
subnet_ids | List of subnets sorted by availability zone in your VPC | list(string) | n/a | yes |
tags | A map of zk instance resource, the default tag is Name=zk-${count.idx} | map(any) | {} | no |
vpc_id | The id of VPC | string | n/a | yes |
zk_config | The default config of zookeeper server | map | { “client_port”: 2181, “zk_heap”: 1024 } | no |
zk_version | The zookeeper version | string | "3.7.1" | no |
Name | Description |
---|---|
zk_node_domain | n/a |
zk_node_private_ip | n/a |
Name | Type |
---|---|
aws_autoscaling_attachment.asg_attachment_lb | resource |
aws_autoscaling_group.ss | resource |
aws_launch_template.ss | resource |
aws_lb.ss | resource |
aws_lb_listener.ss | resource |
aws_lb_target_group.ss_tg | resource |
aws_network_interface.ss | resource |
aws_route53_record.ss | resource |
aws_availability_zones.available | data source |
aws_route53_zone.zone | data source |
aws_vpc.vpc | data source |
Name | Description | Type | Default | Required |
---|---|---|---|---|
cluster_size | The cluster size that same size as available_zones | number | n/a | yes |
hosted_zone_name | The name of the hosted private zone | string | "shardingsphere.org" | no |
image_id | The AMI id | string | n/a | yes |
instance_type | The EC2 instance type | string | n/a | yes |
key_name | the ssh keypair for remote connection | string | n/a | yes |
lb_listener_port | lb listener port | string | n/a | yes |
security_groups | List of The Security groups | list(string) | [] | no |
shardingsphere_version | The shardingsphere version | string | n/a | yes |
subnet_ids | List of subnets sorted by availability zone in your VPC | list(string) | n/a | yes |
vpc_id | The id of your VPC | string | n/a | yes |
zk_servers | The Zookeeper servers | list(string) | n/a | yes |
Name | Description |
---|---|
shardingsphere_domain | The domain name of the ShardingSphere Proxy Cluster for use by other services |