Wednesday, July 13, 2022

Create bulk of VRA deployments with VRA

 How can you deploy bulk of VRA deployments with the minimum effort , the answer will be Terraform 


terraform {
  required_providers {
    vra = {
      source  = "vmware/vra"
      version = "0.5.1"
    }
  }
}

provider "vra" {
  url           = "https://YourVraURL"
# I will explain to you how to get the refresh token in another page
  refresh_token = ""
  insecure      = "false"
}



resource "vra_deployment" "Test_deployment" {
  count = 10
  name  = "Terraform - MAIB.${count.index}"
  #name        = "Terraform - MAIB100"
  description = "Deployment description"

# You can get this information from the service broker page 
# The catalog_item_id you can get it from the URL  
#https://ABC.COM/catalog/#/library/55dc45e8-ba3f-378b-b900-c16a556f7a55
#The project ID can be gotten from the infrastructure and choose the projects and get teh project ID from the URL
#https://ABC.COM/automation-ui/#/provisioning-ui;ash=%2Fprojects%2Fedit%2Fd6437f49-ebf6-41eb-821c-13cabb509fc0

  catalog_item_id      = "55dc45e8-ba3f-378b-b900-c16a556f7a55"
  catalog_item_version = "2021.08.25-01"
  project_id           = "d6437f49-ebf6-41eb-821c-13cabb509fc0"
  

# This inputs will be changable from one customer to another 
  inputs = {
    t_shirt_size    = "small",
    deployment_name = "Terraform - MAIB.${count.index}"
    image              = "Windows 2019"
    Backup             = "No Backup"
    #Patching_Method    = "Automated monthly patching"
    #Patching_Week      = "Fourth"
    #Patching_Day       = "Sunday"
    #Patching_Timeframe = "13:00 - 15:00"

  }

  timeouts {
    create = "30m"
    delete = "30m"
    update = "30m"
  }

# I am using this part because we are migrating from NSX-V to NSX-T and the cloud zone is changed after the migration.

    lifecycle {
    ignore_changes = [
      catalog_item_id,
      catalog_item_version,
      inputs
    ]

  }


}

No comments:

Post a Comment

NSX-T (local log in) with VIDM integration

We will explain how to log in with a local account to your NSX-T which integrated with VIDM. We integrated our NSX-T into the VIDM. We had a...