Posts

Terraform : Create a VPC, IG, SUBNETS , NAT, ROUTE TABLES

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++   Main.tf or vpc.tf     resource "aws_vpc" "my-vpc-superkite" {   cidr_block       = " ${ var . cidr_block } "   # default uses the same hardware as other aws customer   instance_tenancy = " ${ var . instance_tenancy } "     /*   -- enable_dns_hostnames = true   When this setting is enabled, Amazon Route 53 will automatically   create DNS records for the instances in the VPC, allowing them to   be addressed by their hostname. This can be useful for services that   need to be accessed by their hostname instead of their IP address,   or for cases where the IP addresses of the instances may change freq  uently. */   enable_dns_hostnames = true   /*   @color red   -- enable_dns_support   = true @color   W...

Terraform VPC - on AWS : Three tier architecture design

Image
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++   +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ We are going to build a three tier architecture as follows.   AWS Management Console : First Build manually  We are going to build a VPC \ We are going to create public and private subnets under two different available zone . Two more private subnets for database. In addition to that we are going to create an InternetGateway.  And add the routes for the public subnets where by incoming traffics are also allowed by this public subnets. In addition to that we will create NAT Gateway with elastic IPs. Therefore the EC2 instances in the private subnet can communicate to the internet world using the NAT gateway created on the Public subnets.  Above diagram represents what we are planning to build. We will learn about Terraform Modules and Local Values.    43 . Building VPC Manually using AWS Console. http...

PowerDNS -- Pre-Condition

 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++   #data "pdns_rec" "mail" { #type = var.type # locals {    type = var.type #   name = var.name } resource "powerdns_record" "www" { # ... #  for_each = var.records1 #  for_each = { for k, v in var.records1 : k => v }   name = var.name   zone    = var.pdns_zone   type    = var.type   ttl     = var.ttl   records = var.records   lifecycle {     precondition { #      condition = var.type != "" #     condition = data.pdns_rec.mail.type == "MX"       condition = local.type == "mx" #      condition = local.rec == "mx" #      condition = contains(["dctest"], local.name) # ...

Create EC2 -Instance : Exercise 1

 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Code : # Terraform Settings Block terraform {   required_providers {     aws = {       source  = "hashicorp/aws"       #version = "~> 3.21" # Optional but recommended in production     }   } } # Provider Block provider "aws" {   profile = "default" # AWS Credentials Profile configured on your local desktop terminal  $HOME/.aws/credentials   region   = "ap-south-1" } # Resource Block resource "aws_instance" "ec2demo" {   ami           = "ami-074dc0a6f6c764218" # Amazon Linux in us-east-1, update as per your region   instance_type = "t2.micro" }

PowerDNS Turrangrunt

 [root@atlantis-test-cc a_records]# cat terragrunt.hcl locals {   # ========= This Workspace Config   ws_data = yamldecode(file("workspace_params.yml"))   wf_data = yamldecode(file("workflow_params.yml"))   tf_lib_module_release = local.wf_data.tf_code.release_tag } terraform {   source = "${local.wf_data.tf_code.source_url}//?ref=${local.wf_data.tf_code.release_tag}" } #include { #  path = find_in_parent_folders() #} inputs = {   pdns_zone = local.ws_data.terragrunt.resources.pdns_zone #  pdns_name = local.ws_data.terragrunt.resources.pdns_name #  pdns_record = local.ws_data.terragrunt.resources.pdns_record #  rtype = local.ws_data.terragrunt.resources.rtype   records1 = {     record0 = {       name = "ps.dctest.io."       pdns_zone = "dctest.io"       type = "A"       ttl = "300"       records = ["10.10.33.198","10.10.33.199"]     }...

PowerDNS

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ DOMAIN ADDITION  [root@atlantis-test-cc auto_multiple_domain_SRJ]# cat main.tf resource "powerdns_zone" "zone" {   for_each = { for k, v in var.zones : k => v }   name = each.value.name   kind = each.value.kind   nameservers = each.value.nameservers } ====== [root@atlantis-test-cc auto_multiple_domain_SRJ]# cat main.tf resource "powerdns_zone" "zone" {   for_each = { for k, v in var.zones : k => v }   name = each.value.name   kind = each.value.kind   nameservers = each.value.nameservers } [root@atlantis-test-cc auto_multiple_domain_SRJ]# cat variables.tf variable "pdns_api_key" {   type = string   default = "8x8powerdns" } variable "pdns_server_url" {   type = string   default = "http://10.170.20.26:8081" } #variable "pdns_zone" { #  type = stri...

Terraform Basics

 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 7 : Configure AWS CLI Go to IAM --User -- create an administrative credentials and use it. C:\Users\sreejith_b>aws configure AWS Access Key ID [****************FPMZ]: AKIAWVZ2LS7ZIQQ4256N AWS Secret Access Key [****************bRHl]: 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 Default region name [ap-south-1]: ap-south-2 Default output format [None]: 02-02 -- Terraform Command basics. # Terraform Settings Block terraform {   required_providers {     aws = {       source  = "hashicorp/aws"       #version = "~> 3.21" # Optional but recommended in production     }   } } # Provider Block provider "aws" {   profile = "default" # AWS Credentials Profile configured on your local desktop terminal  $HOME/.aws/credentials   region   = "a...