Last active
August 20, 2019 06:06
-
-
Save mamun67/4c13ec1ed469bfc9d940fec218d3ac19 to your computer and use it in GitHub Desktop.
Terraform Notes on getting started with terraform
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Automating Infrastructure Requirements | |
| Provisioning Resources | |
| Planning Updates | |
| Using Source Control | |
| Reusing Templates | |
| Build Usind Go Lang | |
| Install chocolaty and no need to set the path | |
| Terraform Basics | |
| Variable - variable "aws_access_key" | |
| Provider - provider "aws" { | |
| access_key = "access_key" | |
| } | |
| Data Source - data "aws_availability_zones" "available" {} this tells aws provide the list of AZ's and store it in variable available | |
| Resource - provide info about the resource that we want to create | |
| create a subnet in AZ | |
| resource "aws_subnet" "subnet1" | |
| { | |
| cidr_block = "${var.subnet1_address_space}" | |
| vpc_is = "${aws_vpc.vpc.id}" | |
| availability_zone = "${data.aws_availability_zones.available.name[0]}" | |
| } | |
| resource "aws_security_group" "elb-sg" { | |
| name = "nginx_elb_sg" | |
| vpc_id "${aws_vpc.vpc.id}" | |
| ingress {} | |
| egress {} | |
| } | |
| resource "aws_elb" "web" { | |
| name = "nginx-elb" | |
| security_groups = ["${aws_security_group.elb-sg.ud}"] | |
| } | |
| Output - provide out for the aws resource | |
| terraform apply | |
| terraform destroy | |
| terraform plan | |
| terraform verion | |
| to submit the variable form | |
| terraform plan -var-file='..\terraform.tfvars' | |
| to create the infra | |
| terraform apply -var-file='..\terraform.tfvars' | |
| to destroy the infra | |
| terraform destroy -var-file='..\terraform.tfvars' | |
| module.tf will automatically deploy the infra | |
| Updating infrastructure with more resources | |
| Terraform State file - Json file (do not touch) | |
| Terraform is able to | |
| Inspect State | |
| Dependency graph - for example if a sunet needs to be created in a vpc then first vpc needs to be created | |
| Addition or Deletions after update | |
| Configuring Resources After Creation | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment