Table Of Contents
- Terraform Customer Documentation
- Schema documentation
- Directory Structure
- Getting Started for Developers
- Setting up Terraform to use terraform-provider-zededa for Developers
- Sample Terraform configuration files
For Customer documentation, see Terraform Provider ZEDCloud
Schema documentation
- Provider schema
- Resources
- Data Sources
Generating Schema documentation
Use the follong command from the terraform-provider-zedcloud directory to generate
schema documentation:
go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs
Directory Structure:
provider
This directory has the actual code for the provider. It has the the following files:
-
data_source_<object>.go
- Provides the read method for the object ( reads from zedcontrol )
-
resource_<object>.go
- Provides create / update / delete methods for the object
-
provider.go
- This file has the definition for the Provider, defining the data sources
and the resources.
-
flattenutils.go
- Utility routines to flatten API structures into TF Schema format.
-
resourcedatautils.go
- Provides utility routines to convert TF Resource data into API structures.
schemas
This directory has schemas for the objects. The same schema is used for data_sources
as well as the resources.
tftest
This is a test directory. This currently has the Sample schema files and any other
files needed to test the provider.
Getting Started for Developers
- Check out github.com/zededa/zedcloud-api repo.
- Do a make in zedcloud-api (_ cd zededa/zedcloud-api; make _)
- This downloads the swagger files and generates client code.
- This needs to be done only once in your workspace, until there is a new
version of the API
- Do a make in the top level directory to generate the terraform-provider-zededa binary
If not already done so, install the terraform module on your machine. Instructions
can be found at https://terraform.io
To make terraform find and use terraform-provider-zededa, the following must be configured.
- Set the following environment variables:
- TF_CLI_CONFIG_FILE
This must be set to a .tfrc file. A sample is provided in the toplevel
directory (terraform-provider-zedcloud/terraform.tfrc).
Ex: export TF_CLI_CONFIG_FILE=/terraform.tfrc
- TF_LOG_PATH
Configures the path to the log file. All logging from the terraform module
would be redirected to this file.
Ex: export TF_LOG_PATH=/tftest/terraform.log
- TF_LOG
Set this to the desired logging level. Ex: (export TF_LOG=TRACE)
Sample terraform configuration files can be found in tftest directory.
- onedevice_oneappinst.tf.sample
- multinode_multiappinst.tf.sample
To try these out, copy them into a .tf file (for ex: main.tf). terraform automatically
find and process all .tf files in the module.