Skip to content

zscaler/terraform-provider-zia

Repository files navigation

Release GitHub go.mod Go version Go Report Card codecov License Zscaler Community Slack

Terraform logo Zscaler logo

Terraform Provider for ☁️Zscaler Internet Access (ZIA)☁️

Support Disclaimer

-> Disclaimer: Please refer to our General Support Statement before proceeding with the use of this provider. You can also refer to our troubleshooting guide for guidance on typical problems.

Requirements

  • Install Terraform 0.12.x/0.13.x/0.14.x/0.15.x (0.11.x or lower is incompatible)
  • Install Go 1.16+ (This will be used to build the provider plugin.)
  • Create a directory, go, follow this doc to edit ~/.bash_profile to setup the GOPATH environment variable

Building The Provider (Terraform v0.12+)

Clone repository to: $GOPATH/src/github.com/terraform-providers/terraform-provider-zia

mkdir -p $GOPATH/src/github.com/terraform-providers
cd $GOPATH/src/github.com/terraform-providers
git clone https://github.com/terraform-providers/terraform-provider-zia.git

To clone on windows

mkdir %GOPATH%\src\github.com\terraform-providers
cd %GOPATH%\src\github.com\terraform-providers
git clone https://github.com/terraform-providers/terraform-provider-zia.git

Enter the provider directory and build the provider

cd $GOPATH/src/github.com/terraform-providers/terraform-provider-zia
make fmt
make build

To build on Windows

cd %GOPATH%\src\github.com\terraform-providers\terraform-provider-zia
go fmt
go install

Building The Provider (Terraform v0.13+)

MacOS / Linux

Run the following command:

make build13

Windows

Run the following commands for cmd:

cd %GOPATH%\src\github.com\terraform-providers\terraform-provider-zia
go fmt
go install
xcopy "%GOPATH%\bin\terraform-provider-zia.exe" "%APPDATA%\terraform.d\plugins\zscaler.com\zia\zia\1.0.0\windows_amd64\" /Y

Run the following commands if using powershell:

cd "$env:GOPATH\src\github.com\terraform-providers\terraform-provider-zia"
go fmt
go install
xcopy "$env:GOPATH\bin\terraform-provider-zia.exe" "$env:APPDATA\terraform.d\plugins\zscaler.com\zia\zia\1.0.0\windows_amd64\" /Y

Note: For contributions created from forks, the repository should still be cloned under the $GOPATH/src/github.com/terraform-providers/terraform-provider-zia directory to allow the provided make commands to properly run, build, and test this project.

Using Zscaler Internet Access Provider (Terraform v0.12+)

Activate the provider by adding the following to ~/.terraformrc on Linux/Unix.

providers {
  "zia" = "$GOPATH/bin/terraform-provider-zia"
}

For Windows, the file should be at '%APPDATA%\terraform.rc'. Do not change $GOPATH to %GOPATH%.

In Windows, for terraform 0.11.8 and lower use the above text.

In Windows, for terraform 0.11.9 and higher use the following at '%APPDATA%\terraform.rc'

providers {
  "zia" = "$GOPATH/bin/terraform-provider-zia.exe"
}

If the rc file is not present, it should be created

Using Zscaler Internet Access Provider (Terraform v0.13+)

For Terraform v0.13+, to use a locally built version of a provider you must add the following snippet to every module that you want to use the provider in.

terraform {
  required_providers {
    zia = {
      source  = "zscaler/zia"
      version = "2.0.2"
    }
  }
}

Examples

  • Visit here for the complete list of examples.
  • Visit here for the complete documentation of all resources.

Issues

Please feel free to open an issue using Github Issues if you run into any problems using this zia Terraform provider.

Developing the Provider

If you wish to work on the provider, you'll first need Go installed on your machine (version 1.16+ is required). You'll also need to correctly setup a GOPATH, as well as adding $GOPATH/bin to your $PATH.

To compile the provider, run make build. This will build the provider and put the provider binary in the $GOPATH/bin directory.

$ make build
...
$ $GOPATH/bin/terraform-provider-zia
...

In order to test the provider, you can simply run make test.

make test

In order to run the full suite of Acceptance tests, run make testacc.

Note: Acceptance tests create real resources, and often cost money to run.

make testacc

License

=======

Copyright (c) 2022 Zscaler

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.