Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add VPC EIP example, more RDS examples #116

Open
wants to merge 37 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
a962e73
Create main.tf
ippeter Dec 29, 2021
da00416
Create README.md
ippeter Dec 29, 2021
a07ca77
Create main.tf
ippeter Dec 29, 2021
784ed9b
Create README.md
ippeter Dec 29, 2021
30ef687
Create main.tf
ippeter Dec 29, 2021
360e578
Create README.md
ippeter Dec 29, 2021
bd07a51
Create main.tf
ippeter Dec 30, 2021
aa62625
Create README.md
ippeter Dec 30, 2021
0db9b6c
Create main.tf
ippeter Dec 30, 2021
64e426c
Create README.md
ippeter Dec 30, 2021
115b412
Create main.tf
ippeter Dec 30, 2021
88e6e20
Update Notes
ippeter Dec 30, 2021
776a2b0
Create README.md
ippeter Dec 30, 2021
de6d578
Update backup policy
ippeter Dec 30, 2021
6349f7f
Create README.md
ippeter Jan 10, 2022
9aa6b73
Fix typo
ippeter Jan 10, 2022
31cb0f3
Create main.tf
ippeter Jan 10, 2022
a5d4099
Create README.md
ippeter Jan 10, 2022
61147dd
Add Notes
ippeter Jan 10, 2022
2c6a82b
Create main.tf
ippeter Jan 10, 2022
89a869a
Create main.tf
ippeter Jan 10, 2022
776382b
Create README.md
ippeter Jan 10, 2022
f8685f2
Fix typo
ippeter Jan 10, 2022
0e465a8
Create main.tf
ippeter Jan 10, 2022
89f736a
Create README.md
ippeter Jan 10, 2022
efcadd4
Fix comments, add OS
ippeter Feb 1, 2022
e219104
Fix flavor, add OS
ippeter Feb 1, 2022
1e3c259
Fix flavor
ippeter Feb 1, 2022
1fba77f
Create README.md
ippeter Feb 11, 2022
0a906bc
Add a note
ippeter Feb 11, 2022
1d4e4f9
Create main.tf
ippeter Feb 11, 2022
eab99a3
Create README.md
ippeter Feb 11, 2022
c32c1b8
Fix file name
ippeter Feb 11, 2022
3c1f3a5
Move to folder
ippeter Feb 11, 2022
969a4dc
Create main.tf
ippeter Feb 11, 2022
a4e980f
Fix "vcpus" value type, add RDS creation comment
ippeter Feb 11, 2022
5454292
Add RDS creation comment
ippeter Feb 11, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions examples/cce/basic/main.tf
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Get the VPC where NAT gateway will be created
# Get the VPC where CCE cluster will be created
data "sbercloud_vpc" "vpc_01" {
name = "put_here_the_name_of_your_existing_vpc"
}

# Get the subnet where NAT gateway will be created
# Get the subnet where CCE cluster will be created
data "sbercloud_vpc_subnet" "subnet_01" {
name = "put_here_the_name_of_your_existing_subnet"
}
@@ -24,6 +24,7 @@ resource "sbercloud_cce_node" "cce_01_node" {
name = "cce-worker"
flavor_id = "s6.large.2"
availability_zone = "ru-moscow-1a"
os = "CentOS 7.6"
key_pair = "put_here_the_name_of_your_existing_key_pair"

root_volume {
23 changes: 23 additions & 0 deletions examples/cce/cce-nodepool/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## Example: Node Pool for CCE Cluster

### Requirements

- CCE cluster (master(s)) exists in SberCloud.Advanced
- key pair exists in SberCloud.Advanced

### Description

This example provisions a node pool for CCE cluster with the following attributes:

- Node flavor: s6.xlarge.4
- Minimal number of nodes in the pool: 2
- Initial number of nodes in the pool: 2
- Maximum number of nodes in the pool: 10
- Availability zone: ru-moscow-1a

As a result, this example provisions two worker nodes.

### Notes

The **os** paramter is described as Optional, but it's better to set it explicitly to CentOS 7.6
It may simplify upgrades to next CCE releases.
37 changes: 37 additions & 0 deletions examples/cce/cce-nodepool/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Get CCE cluster
data "sbercloud_cce_cluster" "cce_01" {
name = "put_here_the_name_of_your_existing_CCE_cluster"
status = "Available"
}

# Create CCE Node pool
resource "sbercloud_cce_node_pool" "node_pool_01" {
cluster_id = data.sbercloud_cce_cluster.cce_01.id
name = "terraform-pool"
flavor_id = "s6.xlarge.4"
availability_zone = "ru-moscow-1a"
key_pair = "put_here_the_name_of_your_existing_key_pair"
scall_enable = true
min_node_count = 2
initial_node_count = 2
max_node_count = 10
scale_down_cooldown_time = 100
priority = 1
type = "vm"
os = "CentOS 7.6"

labels = {
created_by = "Terraform"
creation_date = "December2021"
}

root_volume {
size = 50
volumetype = "SAS"
}

data_volumes {
size = 100
volumetype = "SAS"
}
}
3 changes: 2 additions & 1 deletion examples/cce/workers-in-different-AZs/main.tf
Original file line number Diff line number Diff line change
@@ -33,8 +33,9 @@ resource "sbercloud_cce_node" "cce_01_node" {
count = local.number_of_workers
cluster_id = sbercloud_cce_cluster.cce_01.id
name = "cce-worker-${count.index}"
flavor_id = "s6.large.2"
flavor_id = "c6.large.4"
availability_zone = data.sbercloud_availability_zones.list_of_az.names[count.index % local.number_of_az]
os = "CentOS 7.6"
key_pair = "put_here_the_name_of_your_existing_key_pair"

root_volume {
24 changes: 24 additions & 0 deletions examples/css/basic/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
## Example: CSS Instance

### Requirements

- VPC exists in SberCloud.Advanced
- subnet exists in SberCloud.Advanced
- security group exists in SberCloud.Advanced

### Description

This example provisions a CSS instance with the following attributes:

- flavor: ess.spec-4u32g (which corresponds to m6.xlarge.8)
- number of nodes: 1
- availability zone: ru-moscow-1a
- Elasticsearch version: 7.9.3
- Disk storage size: 80 GB
- Disk storage type: SSD

### Notes

Please note that there is a backup policy configured and a tag attached to the instance.
Backups (snapshots) will be performed daily at 01:00 MSK, put into the "p-test-02" bucket, into the "css_backups/css-terraform" folder, and stored for 4 days.
The "css_obs_agency" will be used to store backups in OBS.
46 changes: 46 additions & 0 deletions examples/css/basic/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Get the VPC where RDS instance will be created
data "sbercloud_vpc" "vpc_01" {
name = "put_here_name_of_your_existing_VPC"
}

# Get the subnet where RDS instance will be created
data "sbercloud_vpc_subnet" "subnet_01" {
name = "put_here_name_of_your_existing_subnet"
}

# Get the security group for RDS instance
data "sbercloud_networking_secgroup" "sg_01" {
name = "put_here_name_of_your_existing_security_group"
}

resource "sbercloud_css_cluster" "css_prod" {
expect_node_num = 1
name = "css-terraform"
engine_version = "7.9.3"

node_config {
flavor = "ess.spec-4u32g"
network_info {
security_group_id = data.sbercloud_networking_secgroup.sg_01.id
subnet_id = data.sbercloud_vpc_subnet.subnet_01.id
vpc_id = data.sbercloud_vpc.vpc_01.id
}
volume {
volume_type = "ULTRAHIGH"
size = 80
}
availability_zone = "ru-moscow-1a"
}

backup_strategy {
bucket = "p-test-02"
backup_path = "css_backups/css-terraform"
agency = "css_obs_agency"
start_time = "01:00 GMT+03:00"
keep_days = 4
}

tags = {
"environment" = "prod"
}
}
23 changes: 23 additions & 0 deletions examples/dcs/redis-cluster/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## Example: DCS Cluster (Redis)

### Requirements

- VPC exists in SberCloud.Advanced
- subnet exists in SberCloud.Advanced

### Description

This example provisions a DCS cluster of Redis with the following attributes:

- flavor: redis.cluster.xu1.large.r2.8
- availability zones: ru-moscow-1a, ru-moscow-1b. That is, our Redis cluster is geo-redundant.
- Engine: Redis 5.0
- Cache size: 8 GB
- Password protected

### Notes

You can get the list of flavor names by execuring [this API call](https://support.hc.sbercloud.ru/api/dcs/dcs-api-0312040.html) or by looking at the DCS instance creation process in the console.

Note the tag attached to the cluster.
Note the backup schedule configured for the cluster. Backups will be performed each Tuesday, Thursday and Saturday, at **05:00 MSK** (in main.tf time is GMT), and stored for 5 days.
34 changes: 34 additions & 0 deletions examples/dcs/redis-cluster/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Get the VPC where RDS instance will be created
data "sbercloud_vpc" "vpc_01" {
name = "put_here_name_of_your_existing_VPC"
}

# Get the subnet where RDS instance will be created
data "sbercloud_vpc_subnet" "subnet_01" {
name = "put_here_name_of_your_existing_subnet"
}

# Create Redis cluster
resource "sbercloud_dcs_instance" "redis_01" {
name = "redis-tf-cluster"
engine = "Redis"
engine_version = "5.0"
capacity = 8
password = "put_here_password_for_Redis"
vpc_id = data.sbercloud_vpc.vpc_01.id
subnet_id = data.sbercloud_vpc_subnet.subnet_01.id
availability_zones = ["ru-moscow-1a", "ru-moscow-1b"]
flavor = "redis.cluster.xu1.large.r2.8"

backup_policy {
save_days = 5
backup_type = "auto"
begin_at = "02:00-03:00"
period_type = "weekly"
backup_at = [2, 4, 6]
}

tags = {
"environment" = "test"
}
}
20 changes: 20 additions & 0 deletions examples/dcs/redis-single/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## Example: Single DCS Instance (Redis)

### Requirements

- VPC exists in SberCloud.Advanced
- subnet exists in SberCloud.Advanced

### Description

This example provisions a single DCS instance of Redis with the following attributes:

- flavor: redis.single.xu1.large.4
- availability zone: ru-moscow-1b
- Engine: Redis 5.0
- Cache size: 4 GB

### Notes

You can get the list of flavor names by execuring [this API call](https://support.hc.sbercloud.ru/api/dcs/dcs-api-0312040.html) or by looking at the DCS instance creation process in the console.

20 changes: 20 additions & 0 deletions examples/dcs/redis-single/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Get the VPC where RDS instance will be created
data "sbercloud_vpc" "vpc_01" {
name = "put_here_name_of_your_existing_VPC"
}

# Get the subnet where RDS instance will be created
data "sbercloud_vpc_subnet" "subnet_01" {
name = "put_here_name_of_your_existing_subnet"
}

resource "sbercloud_dcs_instance" "redis_01" {
name = "redis-tf-single"
engine = "Redis"
engine_version = "5.0"
capacity = 4
vpc_id = data.sbercloud_vpc.vpc_01.id
subnet_id = data.sbercloud_vpc_subnet.subnet_01.id
availability_zones = ["ru-moscow-1b"]
flavor = "redis.single.xu1.large.4"
}
24 changes: 24 additions & 0 deletions examples/dms/kafka/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
## Example: DMS Cluster (Kafka)

### Requirements

- VPC exists in SberCloud.Advanced
- subnet exists in SberCloud.Advanced
- security group exists in SberCloud.Advanced

### Description

This example provisions a DMS cluster of Kafka with the following attributes:

- engine: Kafka
- version: 2.3.0
- availability zones: ru-moscow-1a, ru-moscow-1b and ru-moscow-1c. That is, our Kafka cluster is geo-redundant and distributed between 3 AZs.
- bandwidth: 300 MB/s
- storage space: 1200 GB
- storage type: SAS

Also, it creates a topic called *topic_01*.

### Notes

It will be a 5 nodes cluster.
52 changes: 52 additions & 0 deletions examples/dms/kafka/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Get the VPC where RDS instance will be created
data "sbercloud_vpc" "vpc_01" {
name = "put_here_name_of_your_existing_VPC"
}

# Get the subnet where RDS instance will be created
data "sbercloud_vpc_subnet" "subnet_01" {
name = "put_here_name_of_your_existing_subnet"
}

# Get the security group for RDS instance
data "sbercloud_networking_secgroup" "sg_01" {
name = "put_here_name_of_your_existing_security_group"
}

# Get the list of Availability Zones (AZ)
data "sbercloud_availability_zones" "list_of_az" {}

# Get the Kafka product details
data "sbercloud_dms_product" "kafka" {
engine = "kafka"
instance_type = "cluster"
version = "2.3.0"
storage = 1200
bandwidth = "300MB"
storage_spec_code = "dms.physical.storage.high"
}

# Create Kafka instance
resource "sbercloud_dms_instance" "kafka_01" {
name = "kafka-tf"

vpc_id = data.sbercloud_vpc.vpc_01.id
subnet_id = data.sbercloud_vpc_subnet.subnet_01.id
security_group_id = data.sbercloud_networking_secgroup.sg_01.id

available_zones = data.sbercloud_availability_zones.list_of_az.names

engine = data.sbercloud_dms_product.kafka.engine
specification = data.sbercloud_dms_product.kafka.bandwidth
product_id = data.sbercloud_dms_product.kafka.id
engine_version = data.sbercloud_dms_product.kafka.version
storage_space = data.sbercloud_dms_product.kafka.storage
storage_spec_code = data.sbercloud_dms_product.kafka.storage_spec_code
}

# Create topic
resource "sbercloud_dms_kafka_topic" "topic" {
instance_id = sbercloud_dms_instance.kafka_01.id
name = "topic_01"
partitions = 16
}
22 changes: 22 additions & 0 deletions examples/dms/rabbitmq/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## Example: DMS Cluster (RabbitMQ)

### Requirements

- VPC exists in SberCloud.Advanced
- subnet exists in SberCloud.Advanced
- security group exists in SberCloud.Advanced

### Description

This example provisions a DMS cluster of RabbitMQ with the following attributes:

- engine: RabbitMQ
- version: 3.7.17
- availability zones: ru-moscow-1a, ru-moscow-1b and ru-moscow-1c. That is, our RabbitMQ cluster is geo-redundant and distributed between 3 AZs.
- storage space: 1000 GB
- storage type: SSD
- user name: admin

### Notes

It will be a 5 nodes cluster.
Loading