This repo contains sample infrastructure as code snippets to deploy, maintain and manage infrastructure on DCS using Terraform vCloud Director provider. | Read-only mirror of https://github.com/swisscom/terraform-dcs-demo — Swisscom. Issues & pull requests at the source.
  • HCL 96.1%
  • Shell 3.9%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2024-10-16 17:40:08 +02:00
internet-load-balancer Sample terraform code for DCS+ using vCloud Director Provider 2019-09-30 16:11:28 +02:00
.gitignore Sample terraform code for DCS+ using vCloud Director Provider 2019-09-30 16:11:28 +02:00
CODE_OF_CONDUCT.md Compliance bulk update. Add CODE_OF_CONDUCT.md 2024-10-16 17:40:08 +02:00
config-values.tfvars Sample terraform code for DCS+ using vCloud Director Provider 2019-09-30 16:11:28 +02:00
CONTRIBUTING.md Compliance bulk update. Add CONTRIBUTING.md 2024-10-16 17:40:07 +02:00
dcs-terraform-basic-sample.tf Sample terraform code for DCS+ using vCloud Director Provider 2019-09-30 16:11:28 +02:00
LICENSE Rename LICENSE.md to LICENSE 2024-10-16 14:52:45 +02:00
main.tf Sample terraform code for DCS+ using vCloud Director Provider 2019-09-30 16:11:28 +02:00
README.md Sample terraform code for DCS+ using vCloud Director Provider 2019-09-30 16:11:28 +02:00
variables.tf Sample terraform code for DCS+ using vCloud Director Provider 2019-09-30 16:11:28 +02:00

DCS Infrastructure as code with Terraform

Introduction

This repo contains sample infrastructure as code snippets to deploy, maintain and manage infrastructure on DCS using Terraform vCloud Director provider.

Terraform enables you to safely and predictably create, change, and improve infrastructure. It is an open source tool that codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned.

Download Terraform based on your operating system to execute terraform code and plans.

Install Terraform by unzipping it and moving it to a directory included in your system's PATH.

How to use this Module

  • Make sure that you have DCS contract and have your Contract Number/Pro-Number ready.

  • Create vCloud Director API User from DCS Self Service Portal.

  • Create Dynamic Data Center from DCS Self Service Portal.

What are these different files

  1. config-values.tfvars This file is to pass configuration values to the terraform apply/destroy commands instead of passing values manually. Edit this file by exchanging the values as per your DCS environment setup.

  2. main.tf This file is to define terraform provider for vCloud Director.

  3. variables.tf This file defines all the needed variables that are referenced in this sample terraform script.

  4. dcs-terraform-basic-sample.tf This sample terraform script shows how terraform can be used to write infrastructure as code in DCS with vCloud Director. This particular example will create a vDC Network,vApp and VM attached to the network.

Quick Start

  1. Open your shell change directory to \terraform-dcs-demo and execute terraform init it will download vCloud Director provider and initialize terraform.
  2. Run terraform validate to make sure the configuration is valid.
  3. Run terraform apply -var-file="config-values.tfvars" to apply the changes required to reach the desired state of the configuration. This will start deploying resources in your DCS contract.
  4. Run terraform destroy -var-file="config-values.tfvars" Infrastructure managed by Terraform will be destroyed. This will ask for confirmation before destroying. This will start destroying resources managed by Terraform in your DCS contract.

References

Terraform

Download Terraform

vCloud Director Terraform Provider

Getting Started with Terraform