Giter Site home page Giter Site logo

terraform-oci-cloudbricks-lbaas's Introduction

OCI Cloud Bricks: Load Balancer

License: UPL Quality gate

Introduction

The following brick allows for provisioning an application or network load balancer in OCI.

Reference Architecture

The following is the reference architecture associated to this brick

Reference Architecture

Prerequisites

  • Pre-baked Artifact and Network Compartments
  • Pre-baked VCN

Sample tfvars file

If using application LBaaS, flexible shape.

########## Application LBaaS, Flexible Shape ##########
########## SAMPLE TFVAR FILE ##########
######################################## COMMON VARIABLES ######################################
region           = "foo-region-1"
tenancy_ocid     = "ocid1.tenancy.oc1..abcdefg"
user_ocid        = "ocid1.user.oc1..aaaaaaabcdefg"
fingerprint      = "fo:oo:ba:ar:ba:ar"
private_key_path = "/absolute/path/to/api/key/your_api_key.pem"
######################################## COMMON VARIABLES ######################################
######################################## ARTIFACT SPECIFIC VARIABLES ######################################
lbaas_instance_compartment_name = "MY_ARTIFACT_COMPARTMENT"
lbaas_network_compartment_name  = "MY_NETWORK_COMPARTMENT"
vcn_display_name                = "MY_VCN"
network_subnet_name             = "MY_SUBNET"
lbaas_display_name              = "LBaaS_Name"
lbaas_shape                     = "flexible"
lbaas_shape_min_bw_mbps         = "100"
lbaas_shape_max_bw_mbps         = "100"
is_private                      = true
lb_nsg_name                     = "MY_NSG"
is_app_lbaas                    = true
######################################## ARTIFACT SPECIFIC VARIABLES ######################################
########## SAMPLE TFVAR FILE ##########
########## Application LBaaS, Flexible Shape ##########

If using application LBaaS, dynamic shape.

########## Application LBaaS, Dynamic Shape ##########
########## SAMPLE TFVAR FILE ##########
######################################## COMMON VARIABLES ######################################
region           = "foo-region-1"
tenancy_ocid     = "ocid1.tenancy.oc1..abcdefg"
user_ocid        = "ocid1.user.oc1..aaaaaaabcdefg"
fingerprint      = "fo:oo:ba:ar:ba:ar"
private_key_path = "/absolute/path/to/api/key/your_api_key.pem"
######################################## COMMON VARIABLES ######################################
######################################## ARTIFACT SPECIFIC VARIABLES ######################################
lbaas_instance_compartment_name = "MY_ARTIFACT_COMPARTMENT"
lbaas_network_compartment_name  = "MY_NETWORK_COMPARTMENT"
vcn_display_name                = "MY_VCN"
network_subnet_name             = "MY_SUBNET"
lbaas_display_name              = "LBaaS_Name"
lbaas_shape                     = "100Mbps"
is_private                      = true
lb_nsg_name                     = "MY_NSG"
is_app_lbaas                    = true
######################################## ARTIFACT SPECIFIC VARIABLES ######################################
########## SAMPLE TFVAR FILE ##########
########## Application LBaaS, Dynamic Shape ##########

If using network LBaaS.

########## Network LBaaS ##########
########## SAMPLE TFVAR FILE ##########
######################################## COMMON VARIABLES ######################################
region           = "foo-region-1"
tenancy_ocid     = "ocid1.tenancy.oc1..abcdefg"
user_ocid        = "ocid1.user.oc1..aaaaaaabcdefg"
fingerprint      = "fo:oo:ba:ar:ba:ar"
private_key_path = "/absolute/path/to/api/key/your_api_key.pem"
######################################## COMMON VARIABLES ######################################
######################################## ARTIFACT SPECIFIC VARIABLES ######################################
lbaas_instance_compartment_name = "MY_ARTIFACT_COMPARTMENT"
lbaas_network_compartment_name  = "MY_NETWORK_COMPARTMENT"
vcn_display_name                = "MY_VCN"
network_subnet_name             = "MY_SUBNET"
lbaas_display_name              = "LBaaS_Name"
is_private                      = true
lb_nsg_name                     = "MY_NSG"
is_app_lbaas                    = false
is_preserve_source_destination  = false
######################################## ARTIFACT SPECIFIC VARIABLES ######################################
########## SAMPLE TFVAR FILE ##########
########## Network LBaaS ##########

Variable Specific Conisderions

  • Optional variable reserved_ip_id allows for attaching an Oracle reserver IP to the load balancer. You must supply the OCID of the reserved IP, for example "ocid1.publicip.oc1.re-region-1.amaaaaaa...". Do not provide a reserved IP when is_private is set to true, as this will change the load balancer to public.
  • Variable lb_nsg_name is an optional network security group that can be attached.
  • Boolean variable is_app_lbaas is used to specify between an application load balancer (true), and a network load balancer (false).
  • Variable lbaas_shape accepts the following values: 10Mbps-Micro, 10Mbps, 100Mbps, 400Mbps, 8000Mbps or flexible.
    • Note1: The flexible shape is used with the variables lbaas_shape_min_bw_mbps and lbaas_shape_max_bw_mbps to specify the minimum and maximum bandwidth respectively. Values can be between 10 (Mbps) and 8000 (Mbps).
    • Note2: The 10Mbps-Micro shape cannot be updated to any other shape nor can any other shape be updated to 10Mbps-Micro.
    • Note3: No shape is specified for a network load balancer.

Sample provider

The following is the base provider definition to be used with this module

terraform {
  required_version = ">= 0.13.5"
}
provider "oci" {
  region       = var.region
  tenancy_ocid = var.tenancy_ocid
  user_ocid        = var.user_ocid
  fingerprint      = var.fingerprint
  private_key_path = var.private_key_path
  disable_auto_retries = "true"
}

provider "oci" {
  alias        = "home"
  region       = data.oci_identity_region_subscriptions.home_region_subscriptions.region_subscriptions[0].region_name
  tenancy_ocid = var.tenancy_ocid  
  user_ocid        = var.user_ocid
  fingerprint      = var.fingerprint
  private_key_path = var.private_key_path
  disable_auto_retries = "true"
}

Requirements

No requirements.

Providers

Name Version
oci 4.40.0

Modules

No modules.

Resources

Name Type
oci_load_balancer.AppLoadBalancer resource
oci_network_load_balancer_network_load_balancer.NetworkLoadBalancer resource
oci_core_network_security_groups.NSG data source
oci_core_subnets.SUBNET data source
oci_core_vcns.VCN data source
oci_identity_compartments.COMPARTMENTS data source
oci_identity_compartments.NWCOMPARTMENTS data source

Inputs

Name Description Type Default Required
fingerprint API Key Fingerprint for user_ocid derived from public API Key imported in OCI User config any n/a yes
is_app_lbaas Determines whether load balancer is an application load balancer, setting this to false will generate a network load balancer bool true no
is_preserve_source_destination This optional parameter can be enabled only if backends are compute OCIDs. When enabled, the skipSourceDestinationCheck parameter is automatically enabled on the load balancer VNIC, and packets are sent to the backend with the entire IP header intact. bool false no
is_private Whether the load balancer has a VCN-local (private) IP address. bool true no
lb_nsg_name Display Name of an optional Network Security Group string "" no
lbaas_display_name A user-friendly name. It does not have to be unique, and it is changeable. Avoid entering confidential information. Example: example_load_balancer any n/a yes
lbaas_instance_compartment_name Defines the compartment name where the infrastructure will be created any n/a yes
lbaas_network_compartment_name Defines the compartment where the Network is currently located any n/a yes
lbaas_shape A template that determines the total pre-provisioned bandwidth (ingress plus egress). To get a list of available shapes, use the ListShapes operation. Example: 100Mbps string "flexible" no
lbaas_shape_max_bw_mbps Bandwidth in Mbps that determines the maximum bandwidth (ingress plus egress) that the load balancer can achieve. This bandwidth cannot always guaranteed. For a guaranteed bandwidth use the minimumBandwidthInMbps parameter. The values must be between minimumBandwidthInMbps and the highest limit available in multiples of 10. The highest limit available is defined in Service Limits. Example: 1500 string "10" no
lbaas_shape_min_bw_mbps Bandwidth in Mbps that determines the total pre-provisioned bandwidth (ingress plus egress). The values must be between 0 and the maximumBandwidthInMbps in multiples of 10. The current allowed maximum value is defined in Service Limits. Example: 150 string "10" no
network_subnet_name Defines the specific Subnet to be used for this resource any n/a yes
private_key_path Private Key Absolute path location where terraform is executed any n/a yes
region Target region where artifacts are going to be created any n/a yes
reserved_ip_id Resereved ip address OCID string "" no
tenancy_ocid OCID of tenancy any n/a yes
user_ocid User OCID in tenancy. Currently hardcoded to user [email protected] any n/a yes
vcn_display_name VCN Display name to execute lookup any n/a yes

Outputs

Name Description
app_lbaas_instance n/a
network_lbaas_instance n/a

Contributing

This project is open source. Please submit your contributions by forking this repository and submitting a pull request! Oracle appreciates any contributions that are made by the open source community.

License

Copyright (c) 2021 Oracle and/or its affiliates.

Licensed under the Universal Permissive License (UPL), Version 1.0.

See LICENSE for more details.

terraform-oci-cloudbricks-lbaas's People

Contributors

dralquinta avatar matt-mcl avatar timclegg avatar ttscoff avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.