Terraform VMC provider update with SDDC Grouping

Gilles Chekroun

Lead VMware Cloud on AWS Solutions Architect
---

With the recent release of VMC terraform provider 1.12, we have now the SDDC Grouping function that will allow us to create SDDC group and attach SDDC.

Code example

/*==============
SDDC Group
===============*/

resource "vmc_sddc_group" "TF_Group" {
name = "TF_Group"
description = "SDDC Group Terraform"
sddc_member_ids = [vmc_sddc.Terraform_SDDC1.id]
}

Just add the sddc_group resource. Give it a name and description and a list of SDDCs you want to attach. Here only one.

Add some outputs you want to get like:
output "vTGW_ID"                    {value = vmc_sddc_group.TF_Group.tgw_id}
output "vTGW_Region" {value = vmc_sddc_group.TF_Group.tgw_region}

terraform apply

Terraform will perform the following actions:


  # module.SDDC.vmc_sddc_group.TF_Group will be created

  + resource "vmc_sddc_group" "TF_Group" {

      + creator                          = (known after apply)

      + deleted                          = (known after apply)

      + description                      = "SDDC Group Terraform"

      + dxgw_allowed_prefixes            = (known after apply)

      + dxgw_id                          = (known after apply)

      + dxgw_owner                       = (known after apply)

      + dxgw_status                      = (known after apply)

      + external_tgw_configured_prefixes = (known after apply)

      + external_tgw_id                  = (known after apply)

      + external_tgw_owner               = (known after apply)

      + external_tgw_region              = (known after apply)

      + id                               = (known after apply)

      + name                             = "TF_Group"

      + org_id                           = (known after apply)

      + sddc_member_ids                  = [

          + "1c64119c-2166-465c-99b0-24a22c8b63b3",

        ]

      + tgw_id                           = (known after apply)

      + tgw_region                       = (known after apply)

      + timestamp                        = (known after apply)

      + vpc_attachment_status            = (known after apply)

      + vpc_aws_account                  = (known after apply)

      + vpc_ram_share_id                 = (known after apply)


      + vpc_attachments {

          + attach_id           = (known after apply)

          + configured_prefixes = (known after apply)

          + state               = (known after apply)

          + vpc_id              = (known after apply)

        }

    }


Plan: 1 to add, 0 to change, 0 to destroy.


Changes to Outputs:

  + vTGW_ID     = (known after apply)

  + vTGW_Region = (known after apply)


Do you want to perform these actions?

  Terraform will perform the actions described above.

  Only 'yes' will be accepted to approve.


  Enter a value: 



Note the various parameters we will get after deployment. Enter YES.

module.SDDC.vmc_sddc_group.TF_Group: Creating...

module.SDDC.vmc_sddc_group.TF_Group: Still creating... [10s elapsed]

module.SDDC.vmc_sddc_group.TF_Group: Still creating... [20s elapsed]


It will take about 4 to 5 mins to create the vTGW and attach the SDDC to it.

module.SDDC.vmc_sddc_group.TF_Group: Still creating... [4m0s elapsed]

module.SDDC.vmc_sddc_group.TF_Group: Still creating... [4m10s elapsed]

module.SDDC.vmc_sddc_group.TF_Group: Creation complete after 4m15s [id=1ed64cde-da72-623e-b5d3-29ff705e3ff3]


Apply complete! Resources: 1 added, 0 changed, 0 destroyed.


Outputs:


Windows_IP = "35.xxx.xxx.xxx"

cloud_password = <sensitive>

cloud_username = "cloudadmin@vmc.local"

nsxt_cloudadmin = "cloud_admin"

nsxt_cloudadmin_password = <sensitive>

nsxt_private_IP = "10.xx.xx.xx"

proxy_url = "nsx-34-xx-xx-xx.rp.vmwarevmc.com/vmc/reverse-proxy/api/orgs/7421a286-f7bf-xxxx-xxxx-779b83d75fb5/sddcs/1c64119c-xxxx-xxxx-99b0-24a22c8b63b3"

sddc_subnet = "subnet-0cccxxxxxx"

vTGW_ID = "tgw-039c8eab775398450"

vTGW_Region = "us-west-2"

vc_public_IP = "34.xxx.xxx.xxx"

vc_url = "vcenter.sddc-34-xxx-xxx-xxx.vmwarevmc.com"

VMC Console

SDDC Group Tab inventory


TF_Group details


Terraform show

# module.SDDC.vmc_sddc_group.TF_Group:

resource "vmc_sddc_group" "TF_Group" {

    creator         = "gchekroun@vmware.com"

    deleted         = false

    description     = "SDDC Group Terraform"

    id              = "1ed64cde-da72-623e-b5d3-29ff705e3ff3"

    name            = "TF_Group"

    org_id          = "7421a286-f7bf-4f34-8567-779b83d75fb5"

    sddc_member_ids = [

        "1c64119c-2166-465c-99b0-24a22c8b63b3",

    ]

    tgw_id          = "tgw-039c8eab775398450"

    tgw_region      = "us-west-2"

    timestamp       = "2022-11-15T10:11:53.652809Z"

}


Note the Group ID, SDDC ID, ORG ID and vTGW ID and Region parameters

Removing SDDC

Clear or comment the SDDC Group code and outputs

Terraform will perform the following actions:


  # module.SDDC.vmc_sddc_group.TF_Group will be destroyed

  # (because vmc_sddc_group.TF_Group is not in configuration)

  - resource "vmc_sddc_group" "TF_Group" {

      - creator         = "gchekroun@vmware.com" -> null

      - deleted         = false -> null

      - description     = "SDDC Group Terraform" -> null

      - id              = "1ed64cde-da72-623e-b5d3-29ff705e3ff3" -> null

      - name            = "TF_Group" -> null

      - org_id          = "7421a286-f7bf-4f34-8567-779b83d75fb5" -> null

      - sddc_member_ids = [

          - "1c64119c-2166-465c-99b0-24a22c8b63b3",

        ] -> null

      - tgw_id          = "tgw-039c8eab775398450" -> null

      - tgw_region      = "us-west-2" -> null

      - timestamp       = "2022-11-15T10:11:53.652809Z" -> null

    }


Plan: 0 to add, 0 to change, 1 to destroy.


Changes to Outputs:

  - vTGW_ID     = "tgw-039c8eab775398450" -> null

  - vTGW_Region = "us-west-2" -> null


Do you want to perform these actions?

  Terraform will perform the actions described above.

  Only 'yes' will be accepted to approve.


  Enter a value: 



module.SDDC.vmc_sddc_group.TF_Group: Destroying... [id=1ed64cde-da72-623e-b5d3-29ff705e3ff3]

module.SDDC.vmc_sddc_group.TF_Group: Still destroying... [id=1ed64cde-da72-623e-b5d3-29ff705e3ff3, 10s elapsed]

module.SDDC.vmc_sddc_group.TF_Group: Still destroying... [id=1ed64cde-da72-623e-b5d3-29ff705e3ff3, 20s elapsed]



After 4 - 5 mins the SDDC Group is deleted

module.SDDC.vmc_sddc_group.TF_Group: Still destroying... [id=1ed64cde-da72-623e-b5d3-29ff705e3ff3, 4m0s elapsed]

module.SDDC.vmc_sddc_group.TF_Group: Still destroying... [id=1ed64cde-da72-623e-b5d3-29ff705e3ff3, 4m10s elapsed]

module.SDDC.vmc_sddc_group.TF_Group: Destruction complete after 4m12s


Apply complete! Resources: 0 added, 0 changed, 1 destroyed.



We will plan to add more features in the future.

Thanks for reading.

Comments

Populars

Egress VPC and AWS Transit Gateway (Part1)

Build a VMware Cloud on AWS Content Library using AWS S3

AWS Transitive routing with Transit Gateways in the same region