Terraform Trivadis LAB VCN for OCI
Introduction
A reusable and extensible Terraform module that provisions a Trivadis LAB VCN on Oracle Cloud Infrastructure
It creates the following resources:
- A VCN with customizable CIDR block
- An optional internet gateway
- An optional NAT gateway
- An optional service gateway
- Optional n-number of VCNs. This is used to build several identical environments for a training and laboratory environment.
The module can be parametrized by the number of participants. This will then create n-VCNs. The following figure shows a VCN for the compartment O-SEC. i.e. resource_name
has been derivated from compartment name.
Prerequisites
- An OCI account
- Install Terraform
- Create a Terraform Configuration
HINT This terraform module does use count
to create multiple identical resources. Due to this at least Terraform version 0.13.0+ is required.
Quickstart
The module is available in Terraform registry. You may either us it via registry or clone terraform-oci-tvdlab-vcn from github.
Add the module to the main.tf
with the mandatory parameter.
module "tvdlab-vcn" {
source = "Trivadis/tvdlab-vcn/oci"
version = ">= 1.0.0"
# - Mandatory Parameters --------------------------------------------------
region = var.region
compartment_id = var.compartment_id
}
To create multiple VCNs just specify the numberOf_labs
parameter. The following example will create 3 equal VCN where each VCN is named according its number and the compartment or if specified according to the variable resource_name
. e.g. for a compartment O-SEC it will create VCN osec00, osec01 and osec02. The naming schema will also be used for all other resources.
module "tvdlab-vcn" {
source = "Trivadis/tvdlab-vcn/oci"
version = ">= 1.0.0"
# - Mandatory Parameters --------------------------------------------------
region = var.region
compartment_id = var.compartment_id
numberOf_labs = 3
}
The module can be customized by a couple of additional parameter. See variables for more information about customisation. The folder examples does contain an example files for main.tf, variables.tv and terraform.tfvars.
Security Configuration
The VCN will be configured with a security list allowing the following access:
- Port 22 inbound SSH traffic
- Port 80 inbound HTTP traffic
- Port 443 inbound HTTPS traffic
- Port 6000-6010 inbound MOSH traffic via UTP
- All protocols in private subnet
- All protocols in between public and private subnet
- All protocols for outbound traffic
Related Documentation, Blog
- Oracle Cloud Infrastructure Documentation
- Terraform OCI Provider Documentation
- Terraform Creating Modules
Projects using this module
- terraform-oci-tvdlab-base A reusable and extensible Terraform module that provisions a Trivadis LAB on Oracle Cloud Infrastructure.
Releases and Changelog
You find all releases and release information here.
Issues
Please file your bug reports, enhancement requests, questions and other support requests within Github's issue tracker.
How to Contribute
- Describe your idea by submitting an issue
- Fork this respository
- Create a branch, commit and publish your changes and enhancements
- Create a pull request
Acknowledgement
Code derived and adapted from oracle-terraform-modules/terraform-oci-vcn and Hashicorp's Terraform 0.12 examples.
License
Copyright (c) 2019, 2020 Trivadis AG and/or its associates. All rights reserved.
The Trivadis Terraform modules are licensed under the Apache License, Version 2.0. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.