Skip to content

The vSphere content library Terraform module either creates or imports a content library as well as a list of items in your VMware Cloud on AWS or VMware vSphere on-premises environment, and then outputs the configuration of each for use in other Terraform projects.

License

aws-ia/terraform-vsphere-content-library

Repository files navigation

vSphere Content Library Terraform Module

This Terraform module creates or imports a datastore‑backed content library in your VMware Cloud on AWS or VMware vSphere on‑premises environment. You can configure the content library as one of three types: standalone, publisher, or subscriber.

You can optionally specify a list of new items, such as OVA and ISO images, to deploy into the new or existing content library or a list of items to import from an existing content library.

Usage

Create a new content library

module "vsphere_content_library" {
  source  = "aws-ia/content-library/vsphere"
  version = ">= 1.0.0"

  datacenter_name              = "SDDC-Datacenter"
  datastore_name               = "WorkloadDatastore"
  content_library_name         = "example-content-library"
  content_library_description  = "Example content library."
  create_content_library       = true
}

Create a new content library with an item

module "vsphere_content_library" {
  source  = "aws-ia/content-library/vsphere"
  version = ">= 1.0.0"

  datacenter_name              = "SDDC-Datacenter"
  datastore_name               = "WorkloadDatastore"
  content_library_name         = "example-content-library"
  content_library_description  = "Example content library."
  create_content_library       = true
  create_content_library_items = true
  content_library_items        = [
    {
      name        = "vmware-tools-windows-12.0.6-20"
      description = "VMware Tools for Windows."
      file_url    = "https://packages.vmware.com/tools/esx/8.0/windows/VMware-tools-windows-12.0.6-20104755.iso"
      type        = "iso"
    },
  ]
}

Create a new item in an existing content library

module "vsphere_content_library" {
  source  = "aws-ia/content-library/vsphere"
  version = ">= 1.0.0"

  content_library_name         = "example-content-library"
  create_content_library       = false
  create_content_library_items = true
  content_library_items        = [
    {
      name        = "vmware-tools-windows-12.0.6-20"
      description = "VMware Tools for Windows."
      file_url    = "https://packages.vmware.com/tools/esx/8.0/windows/VMware-tools-windows-12.0.6-20104755.iso"
      type        = "iso"
    },
  ]
}

Import existing items from an existing content library

module "vsphere_content_library" {
  source  = "aws-ia/content-library/vsphere"
  version = ">= 1.0.0"

  content_library_name         = "example-content-library"
  create_content_library       = false
  create_content_library_items = false
  content_library_items        = [
    {
      name        = "vmware-tools-windows-12.0.6-20"
      description = ""
      file_url    = "n/a"
      type        = "iso"
    },
  ]
}

Create a publisher content library

module "vsphere_content_library" {
  source  = "aws-ia/content-library/vsphere"
  version = ">= 1.0.0"

  content_library_name   = "example-publisher"
  create_content_library = true

  authentication_method = "BASIC"
  password              = var.password
  publication_published = true
}

Create a subscriber content library

module "vsphere_content_library" {
  source  = "aws-ia/content-library/vsphere"
  version = ">= 1.0.0"

  content_library_name   = "example-subscriber"
  create_content_library = true

  subscription_url            = "https://vcenter.sddc-127-0-0-1.vmwarevmc.com:443/cls/vcsp/lib/60d8b31e-c6d0-47d7-9758-ff0f4ff5af14/lib.json"
  authentication_method       = "BASIC"
  password                    = var.password
  subscription_automatic_sync = true
  subscription_on_demand      = false
}

Requirements

Name Version
terraform >= 1.1.0
vsphere >= 2.1.0

Providers

Name Version
vsphere >= 2.1.0

Modules

No modules.

Resources

Name Type
vsphere_content_library.content_library resource
vsphere_content_library_item.items resource
vsphere_content_library.content_library data source
vsphere_content_library_item.items data source
vsphere_datacenter.datacenter data source
vsphere_datastore.datastore data source

Inputs

Name Description Type Default Required
authentication_method Method for authenticating users if creating a publication/subscription relationship between content libraries. string null no
content_library_description The description of the vSphere content library. string null no
content_library_items List of maps of strings defining either OVA/OVF or ISO vSphere content library items (https://docs.vmware.com/en/VMware-vSphere/8.0/vsphere-vm-administration/GUID-D3DD122F-16A5-4F36-8467-97994A854B16.html). At this time, VM template items are not supported by this module, but can be easily added separately. Each map must have the following keys: 'name', 'description', 'file_url', and 'type'. The value for each 'type' key must be set to either 'ovf' or 'iso'. Last, only the value for 'description' can be empty. list(map(string)) [] no
content_library_name The name of the vSphere content library (https://docs.vmware.com/en/VMware-vSphere/8.0/vsphere-vm-administration/GUID-254B2CE8-20A8-43F0-90E8-3F6776C2C896.html). string "Content library" no
create_content_library If true, a new vSphere content library will be created; otherwise, the corresponding content library will be imported as a data source. bool false no
create_content_library_items If true, new vSphere content library items will be created for each specified; otherwise, the corresponding content library items will be imported as a data source. bool false no
datacenter_name The name of the vSphere datacenter object where the content library will be created (https://docs.vmware.com/en/VMware-vSphere/8.0/vsphere-vcenter-esxi-management/GUID-7FDFBDBE-F8AC-4D00-AE5E-3F14D7472FAF.html). string "SDDC-Datacenter" no
datastore_name The name of the vSphere datastore object where the content library items will be stored (https://docs.vmware.com/en/VMware-vSphere/8.0/vsphere-storage/GUID-7BED10DD-3EF2-4670-BA7F-0EEB4EC6EB85.html). string "WorkloadDatastore" no
password Password if creating a publication/subscription relationship between content libraries with authentication. Password length and complexity requirements are determined by the configuration in vCenter. string null no
publication_published If true, publish the content library if creating a publication/subscription relationship between content libraries. bool null no
subscription_automatic_sync If true, enable automatic synchronization with the published library if creating a publication/subscription relationship between content libraries. bool null no
subscription_on_demand If true, download the published content library items only when needed if creating a publication/subscription relationship between content libraries. bool null no
subscription_url URL of the published content library if creating a publication/subscription relationship between content libraries. string null no

Outputs

Name Description
content_library The vSphere content library.
items The list of vSphere content library items.

About

The vSphere content library Terraform module either creates or imports a content library as well as a list of items in your VMware Cloud on AWS or VMware vSphere on-premises environment, and then outputs the configuration of each for use in other Terraform projects.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published