Skip to content

terraform-opentelekomcloud-modules/terraform-opentelekomcloud-rds

Repository files navigation

OpenTelekomCloud RDS Terraform module

Terraform module which creates RDSv3 resources on OpenTelekomCloud.

These types of resources are supported:

Terraform versions

Terraform 0.13 and newer.

Usage

module "vpc" {
  source = "terraform-opentelekomcloud-modules/vpc/opentelekomcloud"

  prefix = "infra"

  availability_zone = "eu-de-01"
  vpc_cidr          = "10.0.0.0/24"
  subnet_cidr       = "10.0.0.0/24"
  gateway_ip        = "10.0.0.1"
  ntp_addresses     = ["10.100.0.33", "10.100.0.34"]

  dhcp_enable = true
  snat_enable = true

  tags = {
    infra = "vpc"
  }
}


module "ssh_sg" {
  source = "terraform-opentelekomcloud-modules/security-group/opentelekomcloud"
  prefix      = "ssh"
  description = "Simple security group for SSH"

  ingress_with_source_cidr = [
    {
      from_port   = 22
      to_port     = 22
      protocol    = "tcp"
      source_cidr = "0.0.0.0/0"
    }
  ]
}

module "db" {
  source = "terraform-opentelekomcloud-modules/rds/opentelekomcloud"

  availability_zone = ["eu-de-01"]
  db_password       = "5ecurePa55w0rd@"
  db_type           = "PostgreSQL"
  db_version        = "11"
  secgroup_id       = module.ssh_sg.security_group_id
  network_id        = module.vpc.network_id
  vpc_id            = module.vpc.vpc_id
  db_flavor         = "rds.pg.c2.medium"
  volume_size       = 100

  tags = {
    infra = "rds"
  }
}

Examples

Requirements

Name Version
terraform >= 0.13
opentelekomcloud >= 1.23.9

Modules

No modules.

Resources

Name Type
opentelekomcloud_rds_parametergroup_v3.this resource
opentelekomcloud_rds_instance_v3.this resource
opentelekomcloud_rds_read_replica_v3.this resource

Inputs

Name Description Type Default Required
prefix Prefix for RDSv3 infrastructure module string "default" no
rds_instance_id The ID of the RDSv3 db instance string "" no
snat_create_rds Whether to create RDSv3 db instance bool true no
availability_zone The availability zone list of the RDSv3 instance (Multiple AZ must be specified if you are using HA) list(string) ["eu-de-01"] yes
vpc_id The ID of the VPC where to create RDSv3 infrstructure string "" yes
secgroup_id ID of existing security group string "" yes
network_id ID of the network where to create RDSv3 infrstructure string "" yes
db_type The database db engine type to use string "" yes
db_version The db engine version to use string "" yes
db_port The port on which the RDSv3 accepts connections number null no
db_password Password for the master DB user string "" yes
db_flavor The db instance flavor specification code string "" yes
ha_replication_mode Specifies the replication mode for the standby DB instance string "" no
volume_type The volume type of the RDSv3 instance string "COMMON" yes
volume_size The volume size of the RDSv3 instance number null yes
volume_encryption_id The ID for the KMS encryption key string "" no
backup_start_time The window to perform maintenance in. Eg: '00:00-01:00'" string "00:00-01:00" yes
backup_keep_days The days to retain backups for number null no
tags The key/value tag pairs to associate with the RDSv3 db instance map(string) null no
parametergroup_values Map of the values of the RDSv3 db parameter group map(string) {} no
parametergroup_description Description of the RDSv3 parameter group to create string "" no
read_replica_config The configuration of RDSv3 db read replica instances list(object({name = string, flavor = string, availability_zone = string, public_ips = list(string), volume_type = string, volume_encryption_id = string})) [] no

Outputs

Name Description
rds_instance_id ID of the RDSv3 db instance
rds_instance_name Name of the RDSv3 db instance
rds_parametergroup_id ID of the RDSv3 db parameter group
rds_read_replica_ids IDs of the RDSv3 db read replica
rds_instance_nodes List of the RDSv3 db instance nodes
rds_instance_private_ips List of the RDSv3 db instance private IPs
rds_instance_public_ips List of the RDSv3 db instance public IPs

Authors

Module managed by Rodion Gyrbu.

License

Apache 2 Licensed. See LICENSE for full details.