cloud,

Ansible for VMware

Follow · 1 min read
Share this

VM Migration: Planning

terraform -v

git clone https://github.com/morgante/terraform-codelab.git cd terraform-codelab/lab-networking

edit terraform.tfvars -> open editor project_id=”qwiklabs-gcp-01-eb85e88d83fc”

gcloud iam service-accounts create terraform –display-name terraform

gcloud iam service-accounts list

gcloud iam service-accounts keys create ./credentials.json –iam-account terraform@qwiklabs-gcp-01-eb85e88d83fc.iam.gserviceaccount.com

gcloud projects add-iam-policy-binding qwiklabs-gcp-01-eb85e88d83fc –member=serviceAccount:terraform@qwiklabs-gcp-01-eb85e88d83fc.iam.gserviceaccount.com –role=roles/owner

— setup remote state

gsutil mb gs://qwiklabs-gcp-01-eb85e88d83fc-state-bucket

– edit backend.tf

terraform { backend “gcs” { bucket = “qwiklabs-gcp-01-eb85e88d83fc-state-bucket” # Change this to -state-bucket prefix = "terraform/lab/network" } }

— run terraform

terraform init

terraform plan

terraform apply

terraform show

– add a subnet

edit network.tf

# # Create the network
module "vpc" {
  source  = "terraform-google-modules/network/google"
  version = "~> 0.4.0"

  # Give the network a name and project
  project_id   = "${google_project_service.compute.project}"
  network_name = "my-custom-network"

  subnets = [
    {
      # Creates your first subnet in us-west1 and defines a range for it
      subnet_name   = "my-first-subnet"
      subnet_ip     = "10.10.10.0/24"
      subnet_region = "us-west1"
    },
    {
      # Creates a dedicated subnet for GKE
      subnet_name   = "my-gke-subnet"
      subnet_ip     = "10.10.20.0/24"
      subnet_region = "us-west1"
    },
    # Add your subnet here
  ]

  # Define secondary ranges for each of your subnets
  secondary_ranges = {
    my-first-subnet = []

    my-gke-subnet = [
      {
        # Define a secondary range for Kubernetes pods to use
        range_name    = "my-gke-pods-range"
        ip_cidr_range = "192.168.64.0/24"
      },
    ]
    # Add your subnet’s secondary range below this line.

  }
}

terraform apply

Latest Stories

HashiCorp Certified Terraform Associate – Learning & Exam Tips

I started using Terraform somewhere in 2018, but very limited usage as I thought it is just another tool for provisioning infrastructure and other services – or a variant of Vagrant; ...

In terraform, Sep 18, 2020
Deploy Minikube Using Vagrant and Ansible on VirtualBox – Infrastructure as Code

Minikube is a tool to run a kubernetes cluster locally, that means on your laptop or inside a virtual machine. Minikube will run a single node kubernetes cluster on your machine with ...

In kubernetes, Aug 11, 2020
How to Pass CKA & CKAD Exams ? 10 Tips for Kubernetes Exams

Here see the best tips for Kubernetes Exams - Certified Kubernetes Administrator (CKA) & Certified Kubernetes Application Developer (CKAD).

In kubernetes, Jul 08, 2020
CKA & CKAD - Kubernetes Exam Tips, Learning Path and Certification

Since kubernetes is getting wide acceptance, Kubernetes Certification is the most trending one in IT circle now. I have completed both recently (March – April 2020) and I started gett...

In kubernetes, May 03, 2020

Featured