Mastering Terraform and The Provider
Mastering Terraform and The Provider
Agenda ● Summary
Agenda ● Summary
@gregoryguillou
gregoryguillou
Agenda ● Summary
● Infrastructure as Code
● A go application
● HCL/JSON with an inference syntax
● Immutable Infrastructure
● State management
● Dozens of providers, including OCI
● GIT and Registry
● Open-source and enterprise versions
● Introduction
● Terraform fundamentals
● Terraform OCI provider
● Coding and good practices
Agenda ● Summary
Agenda ● Summary
Checkout 03-inferences.md
Modules (04-demo)
● Create a directory to move the resource for your module
● Remove the resource from your original stack
● Create variable and output to encapsulate your logic
module "livecode" {
tenancy = "${var.tenancy}"
compartment = "${var.compartment}"
source = "github.com/gregoryguillou/oci-workshop?ref=04-demo//modules/public-network"
}
Checkout 05-packer.md
dynamicgroups and OCI_CLI_AUTH (06-demo)
● Deploy a dynamic group and its policy
● Access the remote instance from SSH
● Use the metadata API to figure out the compartment
● Use the OCI CLI without any credentials
export OCI_CLI_AUTH=instance_principal
oci os bucket list --compartment-id=$COMPARTMENT \
--query='data[].{bucket: name}' --output=table
Checkout 06-dynamicgroups.md
Use other providers (07-demo)
● There are a lot of useful providers, including random, null,
http, external, template or terraform_remote, for instance:
data "external" "version" {
program = ["${path.module}/version.sh"]
query = {
workspace = "${terraform.workspace}"
}
}
output "oci-workshop" {
value = "${lookup(data.external.version.result, "oci-workshop")}"
}
Checkout 08-secrets.md
Destroy your stack (08-demo)
terraform destroy
Checkout 08-secrets.md
Random thoughts
● KISS and DRY
○ Use as few external tools as possible
○ Avoid provisioners and null_resource
● Add +1 to tag support for Terraform OCI provider #400
● Add +1 to support the container registry and OKE
● Don’t use terraform for Windows
● Rely on LetsEncrypt/DNS to generate SSL certificates
● Use Kubernetes (OKE) and a CI/CD for your application
● Implement Chatops and self-service
● Introduction
● Terraform fundamentals
● Terraform OCI provider
● Coding and good practices
Agenda ● Summary
gregoryguillou/terraform-api
gregoryguillou/hubot-terraform
Thank you !!!
We are hiring...