Skip to content

Latest commit

 

History

History
158 lines (129 loc) · 6.84 KB

README.md

File metadata and controls

158 lines (129 loc) · 6.84 KB

terraform-sbercloud-vpc

Sbercloud VPC Terraform module

Features

  • Create vpc, subnets, nat gateways, routes for subnet route tables
  • Easy to use in other resources via outputs

How to Configure Terraform for Sbercloud

export SBC_ACCESS_KEY="xxxx-xxx-xxx"
export SBC_SECRET_KEY="xxxx-xxx-xxx"

Provider configuration

provider "sbercloud" {
  auth_url = "https://iam.ru-moscow-1.hc.sbercloud.ru/v3"
  region   = "ru-moscow-1"
}

Usage

module "vpc" {
    source  = "tf-cloud-modules/vpc/sbercloud"

    name = "tf-vpc-test"
    cidr = "10.0.0.0/16"

    azs = ["ru-moscow-1a", "ru-moscow-1b"]
    subnets = [
    {
        cidr       = "10.0.0.0/24"
        gateway_ip = "10.0.0.1"

        nat_gw = {
        spec = "1"
        }

        eip = {
        type        = "5_bgp"
        share_type  = "PER"
        size        = 1
        charge_mode = "traffic"
        }

        # vip_routes = [
        #   {
        #     destination = "192.168.100.0/24"
        #     nexthop     = "10.0.0.117"
        #     description = "test"
        #   }
        # ]

        ecs_routes     = []
        eni_routes     = []
        nat_routes     = []
        peering_routes = []
        vpn_routes     = []
        dc_routes      = []
        cc_routes      = []

        # existing_eip = "xxxx-xxx-xxx" # excludes eip creation and use existing one, has precedence over eip creation

    },
    {
        cidr       = "10.0.1.0/24"
        gateway_ip = "10.0.1.1"
    },
    ]

    dhcp_enable   = true
    primary_dns   = "100.125.13.59"
    secondary_dns = "8.8.8.8"

    tags = {
    env = "test"
    }

    # default_route_table_routes = [
    #   {
    #     destination = "10.0.x.x/0"
    #     type        = "xxx"
    #     nexthop     = "xxxxx-xxx-xxx"
    #   },
    # ]
}

Requirements

Name Version
terraform >= 0.13.1
sbercloud >= 1.9.0, < 2.0.0

Providers

Name Version
sbercloud 1.10.0

Modules

No modules.

Resources

Name Type
sbercloud_nat_gateway.this resource
sbercloud_nat_snat_rule.this resource
sbercloud_vpc.this resource
sbercloud_vpc_eip.snat resource
sbercloud_vpc_route.default_route resource
sbercloud_vpc_route_table.subnet resource
sbercloud_vpc_subnet.this resource

Inputs

Name Description Type Default Required
azs A list of availability zones names or ids in the region list(string) [] no
cidr Specifies the range of available subnets in the VPC. string n/a yes
create_vpc Controls if VPC should be created. bool true no
default_route_table_routes Configuration block of routes. list(any) [] no
description Specifies supplementary information about the VPC. string null no
dhcp_enable Specifies whether the DHCP function is enabled for the subnet. bool false no
dns_list Specifies the DNS server address list of a subnet. list(string) null no
enterprise_project_id Specifies the enterprise project id of the VPC. string null no
name Specifies the name of the VPC. string n/a yes
primary_dns Specifies the IP address of DNS server 1 on the subnet. string null no
region Specifies the region in which to create the VPC. string null no
secondary_dns Specifies the IP address of DNS server 2 on the subnet. string null no
subnet_names Explicit values to use in the name values on subnets. If empty, name values are generated. list(string) [] no
subnet_tags List of subnet tags. map(string) {} no
subnets A list of subnets inside the VPC any [] no
tags List of common tags. map(string) {} no
vpc_id Existing VPC where resources will be created. string null no
vpc_tags List of VPC tags. map(string) {} no

Outputs

Name Description
cidr Specifies the range of available subnets in the VPC.
enterprise_project_id Specifies the enterprise project id of the VPC.
id The VPC ID in UUID format.
name Specifies the name of the VPC.
region Specifies the region in which to create the VPC.
subnet_cidr_blocks List of cidrs of subnets
subnet_ids List of IDs of subnets