Skip to content

FlexibleEngineCloud/terraform-flexibleengine-vpcpeering

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flexible Engine Peering Terraform Module

Terraform module which creates peering between VPC on Flexible Engine.

Usage : Terraform

This module requires that many providers are created in terraform environment description.

In case VPC are in the same tenant, don't forget to set same_tenant to true in module calling.

Example with 2 providers:

provider "flexibleengine" {
  alias     = "tenant_stage"
  user_id   = "xxx"
  password  = "foo_bar"
  tenant_id = var.tenant_id_tenant_stage
  auth_url  = var.auth_url
  region    = var.region
}

provider "flexibleengine" {
  alias     = "tenant_prod"
  user_id   = "xxx"
  password  = "foo_bar"
  tenant_id = var.tenant_id_tenant_prod
  auth_url  = var.auth_url
  region    = var.region
}

Example of module call:

module "peering_stage_prod" {
  source = "terraform-flexibleengine-modules/vpcpeering/flexibleengine"
  version = "1.0.0"

  providers = {
    flexibleengine.requester = flexibleengine.tenant_prod
    flexibleengine.accepter = flexibleengine.tenant_stage
  }

  peer_name = "peering-stage-prod"

  vpc_req_name       = "vpc-prod"

  vpc_acc_name       = "vpc-stage"

  req_subnet_cidr = [
    "10.10.1.0/24",
    "10.10.2.0/24",
  ]

  acc_subnet_cidr = [
    "192.168.1.0/24",
  ]

  tenant_acc_id = "TENANT_ACC_ID"
}

Usage : Terragrunt

Example of module call:

################################
### Terragrunt Configuration ###
################################

terraform {
  source = "terraform-flexibleengine-modules/vpcpeering/flexibleengine"
  version = "1.0.0"
}

include {
  path = find_in_parent_folders()
}

##################
### Parameters ###
##################

inputs = {

  
  providers = {
    flexibleengine.requester = flexibleengine.tenant_prod
    flexibleengine.accepter = flexibleengine.tenant_stage
  }

  peer_name = "peering-stage-prod"

  vpc_req_name       = "vpc-prod"

  vpc_acc_name       = "vpc-stage"

  req_subnet_cidr = [
    "10.10.1.0/24",
    "10.10.2.0/24",
  ]

  acc_subnet_cidr = [
    "192.168.1.0/24",
  ]

  tenant_acc_id = "TENANT_ACC_ID"
}

Requirements

Name Version
terraform >= 0.13

Providers

Name Version
flexibleengine.accepter n/a
flexibleengine.requester n/a

Modules

No modules.

Resources

Name Type
flexibleengine_vpc_peering_connection_accepter_v2.peer resource
flexibleengine_vpc_peering_connection_v2.peering resource
flexibleengine_vpc_route_v2.acc_vpc_route resource
flexibleengine_vpc_route_v2.req_vpc_route resource
flexibleengine_vpc_v1.vpc_acc data source
flexibleengine_vpc_v1.vpc_req data source

Inputs

Name Description Type Default Required
acc_subnet_cidr list of accepter's subnet CIDR list [] no
peer_name Name of the peering connection string "" no
req_subnet_cidr list of requester's subnet CIDR list [] no
same_tenant Indicates VPC are in the same tenant bool false no
tenant_acc_id tenant ID of the accepter string "" no
vpc_acc_id ID of accepter's VPC any null no
vpc_acc_name Name of accepter's VPC any null no
vpc_req_id ID of the requester's VPC any null no
vpc_req_name Name of the requester's VPC any null no

Outputs

Name Description
peering_id ID of the created peering