Skip to content

citrix/terraform-provider-citrix

Repository files navigation

Plugin for Terraform Provider for Citrix®

Citrix has developed a custom Terraform provider for automating Citrix product deployments and configurations. Using Terraform with Citrix provider, you can manage your Citrix products via Infrastructure as Code, giving you higher efficiency and consistency on infrastructure management, as well as better reusability on infrastructure configuration. The provider is developed and maintained by Citrix.

Table of Contents

Contacting the Maintainers

This project uses GitHub to track all issues. See CONTRIBUTING.md for more information.

Examples

Basic example templates for getting started can be found in the repository at examples/

Deployment guides

Please refer to Citrix Tech Zone to find detailed guides on how to deploy and manage resources using the Citrix provider:

Demo video

alt text

https://www.youtube.com/watch?v=c33sMLaCVjY

Plugin for Terraform Provider for Citrix® Documentation

Navigating the repository

  1. internal folder - Contains the following sub directories:
    • provider folder - Contains the Citrix provider implementation for Terraform
    • daas folder - Contains all the Citrix DaaS resources libraries that we support through Terraform.
    • test folder - Contains the Go tests for both provider and all resources that we have.
    • util folder - Contains general utility functions that can be reused.
  2. examples folder - Contains the examples for users to use various Citrix resources e.g zone folder contains the resources.tf that illustrates how citrix_zone resource can be used to create a DaaS Zone on target Citrix DaaS site. There are also examples for Citrix provider configuration for both Citrix Cloud customer and Citrix on-premises customers. Users can use the examples as a starting point to configure their own Citrix Terraform script.
  3. docs folder - resources - contains the documentation for all resource configurations supported through Terraform. Refer this to understand the properties, accepted values, and how various properties work together for each type of resource.

Provider Configuration

provider.tf contains the information on target DaaS site where you want to apply configuration.

Depending on whether its managing a Citrix Cloud site, or a Citrix on-premises site, Citrix provider should be configured differently.

Example for on-premises site:

provider "citrix" {
    cvad_config = {
      hostname      = "10.71.136.250"  # Optionally set with `CITRIX_HOSTNAME` environment variable.
      client_id     = "${var.domain_admin_id}"  # Optionally set with `CITRIX_CLIENT_ID` environment variable.
      client_secret = "${var.domain_admin_secret}"  # Optionally set with `CITRIX_CLIENT_SECRET` environment variable.
    }
}

Example for Cloud site:

provider "citrix" {
    cvad_config = {
      customer_id   = "${var.customer_id}"  # Optionally set with `CITRIX_CUSTOMER_ID` environment variable.
      client_id     = "${var.api_key_clientId}"  # Optionally set with `CITRIX_CLIENT_ID` environment variable.
      client_secret = "${var.api_key_clientSecret}"  # Optionally set with `CITRIX_CLIENT_SECRET` environment variable.
    }
}

You can use environment variables as stated in the comments above. When running Go tests, always use environment variables so that no credentials or other sensitive information are checked-in to the code.

Below is a table to show the difference between on-premises and Cloud provider configuration:

Cloud On-Premises
environment Production, Japan, Gov N/A
customerId Cloud Customer Id N/A
hostname (Optional) Cloud DDC hostname On-Premises DDC Hostname / IP address
clientId Citrix Cloud API Key clientId Domain Admin Username
clientSecret Citrix Cloud API Key clientSecret Domain Admin Password

Resource Configuration

Resources.tf can be used to configure the desired state of the resources that you want to create and manage in your Citrix Services. The example below shows how you can configure a Citrix DaaS Zone in Citrix DaaS service in resource.tf.

citrix_zone

resource "citrix_zone" "example-zone" {
    name                = "example-zone"
    description         = "zone example"
    metadata            = [
        {
            name    = "key1"
            value   = "value1"
        }
    ]
}

Please refer the Plugin for Terraform Provider for Citrix DaaS™ documentation such as docs/resources/zone.md to find out the configurable properties of each type of resources, understand what they do, and what option values are supported.


Using the Plugin for Terraform Provider for Citrix DaaS™

Install Terraform

Refer the Hashicorp documentation for installing Terraform CLI for your own environment.

(On-Premises Only) Enable Web Studio

For on-premises sites with version >= 2311 are supported. Web Studio needs to be installed and configured for the provider to work.

Configure your Plugin for Terraform Provider for Citrix DaaS™

Refer section Understanding Provider Configuration or Provider documentation to configure the provider for the Citrix DaaS site you want to manage with Terraform.

Start writing Terraform for managing your Citrix DaaS site

To find all the Citrix DaaS resources manageable via Terraform, understand all the configurable properties for each resource and how they work together, refer documentations for resources in Citrix Terraform resource documentation. To better understand how the resource is managed via Citrix DaaS Rest API, you can refer the Citrix DaaS Rest API documentation.

Create a Zone in Citrix DaaS as the first step

Refer the DaaS Zone documentation to configure a zone via terraform.

Create a Hypervisor

Hypervisor is needed to use your preferred public cloud provider with Citrix DaaS. Refer the DaaS Hypervisor documentation to configure an Azure hypervisor in a zone via terraform.

Create a Hypervisor Resource Pool

The hypervisor resource pool defines the network configuration for a hypervisor connection. Refer the DaaS Hypervisor Resource Pool documentation to configure an Azure hypervisr resource pool via terraform.

Create a Machine Catalog

A machine catalog is a collection of machines managed as a single entity. Refer the DaaS Machine Catalog documentation to configure a machine catalog via terraform.

Create a Delivery Group

A delivery group is a collection of machines selected from one or more machine catalogs. The delivery group can also specify which users can use those machines, plus the applications and desktops available to those users. Refer the DaaS Delivery Group documentation to configure a delivery group via terraform.

Using the Plugin for Terraform Provider for other Citrix resources

Configure Global App Configuration (GAC) Settings

The Global App Configuration service provides a centralized setup for IT admins to easily configure Citrix Workspace app settings on Windows, Mac, Android, iOS, HTML5, Chrome OS platforms. Please refer to Global App Configuration settings documentation to configure GAC settings via terraform.

Create Citrix Cloud Resource Locations

Resource locations contain the resources (e.g. cloud connectors) required to deliver applications and desktops to users. Resource locations are only supported for Cloud customers. On-premises customers can use the zone resource directly. Please refer to Citrix Resource Location documentation to configure citrix cloud resource locations via terraform.

Managing StoreFront resources

Please refer to the StoreFront.md to configure StoreFront resources via terraform. Note that this feature is in Tech Preview.

Managing DaaS Quick Deploy resources

QuickCreate service allows customers to create and manage Amazon WorkSpaces Core instances in Amazon Web Services (AWS). Please refer to the QuickCreate documentation to learn more. Note that this feature is in Tech Preview.

Frequently Asked Questions

What resource is supported for different connection types?

Connection Type Hypervisor Resource Pool MCS Power Managed MCS Provisioning PVS Manual/Remote PC
AzureRM ✔️ ✔️ ✔️ ✔️ ✔️ ✔️
AWS EC2 ✔️ ✔️ ✔️ ✔️ ✖️ ✔️
GCP ✔️ ✔️ ✔️ ✔️ ✖️ ✔️
vSphere ✔️ ✔️ ✔️ ✔️ ✖️ ✔️
XenServer ✔️ ✔️ ✔️ ✔️ ✖️ ✔️
Nutanix ✔️ ✔️ ✔️ ✔️ ✖️ ✔️
SCVMM ✔️ ✔️ ✔️ ✔️ ✖️ ✔️

Attributions

The code in this repository makes use of the following packages:

License

This project is Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2024. Citrix Systems, Inc.