The Terraform Equinix provider is a plugin for Terraform that allows for lifecycle management of Equinix Platform resources.
See the Equinix Provider documentation to get started using the Equinix provider.
- Data source: ECXF port
- Data source: ECXF layer 2 seller profile
- Resource: ECXF layer 2 connection
- Resource: ECXF layer 2 connection accepter
- Resource: ECXF layer 2 service profile
See Equinix Provider Examples for use case driven guides to managing Equinix services with Terraform.
-
Clone Equinix Terraform Provider repository
git clone https://github.com/equinix/terraform-provider-equinix.git
-
Build the provider
Enter the provider directory and build the provider:
cd terraform-provider-equinix make build
-
Install the provider
Provider binary can be installed in terraform plugins directory
~/.terraform.d/plugins
by running make with install target:make install
-
use Go programming best practices, gofmt, go_vet, golint, ineffassign, etc.
-
enter the provider directory
cd terraform-provider-equinix
-
to build, use make
build
targetmake build
-
to run unit tests, use make
test
targetmake test
-
to run acceptance tests, use make
testacc
targetmake testacc
Check "Running acceptance tests" section for more details.
NOTE: acceptance tests create resources on real infrastructure, thus may be subject for costs. In order to run acceptance tests, you must set necessary provider configuration attributes.
export EQUINIX_API_ENDPOINT=https://api.equinix.com
export EQUINIX_API_CLIENTID=someID
export EQUINIX_API_CLIENTSECRET=someSecret
make testacc
ECX Port data source acceptance tests use below parameters, that can be set to match with desired testing environment. If not set, defaults values, from Sandbox environment are used.
- TF_ACC_ECX_PORT_NAME - sets name of the port used in data source
ECX Layer 2 connection acceptance tests use below parameters, that can be set to match with desired testing environment. If not set, defaults values, from Sandbox environment are used.
- TF_ACC_ECX_L2_AWS_SP_ID - sets UUID of Layer2 service profile for AWS
- TF_ACC_ECX_L2_AZURE_SP_ID - sets UUID of Layer2 service profile for Azure
- TF_ACC_ECX_PRI_DOT1Q_PORT_ID - sets UUID of Dot1Q encapsulated port on primary device
- TF_ACC_ECX_SEC_DOT1Q_PORT_ID - sets UUID of Dot1Q encapsulated port on secondary device
Example - running tests on Sandbox environment but with defined ports:
export EQUINIX_API_ENDPOINT=https://sandboxapi.equinix.com
export EQUINIX_API_CLIENTID=someID
export EQUINIX_API_CLIENTSECRET=someSecret
export TF_ACC_ECX_PRI_DOT1Q_PORT_ID="6ca3704b-c660-4c6f-9e66-3282f8de787b"
export TF_ACC_ECX_SEC_DOT1Q_PORT_ID="7a80ab13-4e04-455c-82e3-79d962d0c0c3"
make testacc