linode / terraform-provider-linode

Terraform Linode provider
https://www.terraform.io/docs/providers/linode/
Mozilla Public License 2.0
202 stars 98 forks source link
linode terraform terraform-provider

Terraform Provider for Linode

Release GoDoc Go Report Card Gitter chat

Maintainers

This provider plugin is maintained by Linode.

Requirements

Using the provider

See the Linode Provider documentation to get started using the Linode provider. The examples included in this repository demonstrate usage of many of the Linode provider resources.

Additional documentation and examples are provided in the Linode Guide, Using Terraform to Provision Linode Environments.

Development

Building the provider

If you wish to build or contribute code to the provider, you'll first need Git and Go installed on your machine (version 1.11+ is required).

You'll also need to correctly configure a GOPATH, as well as adding $GOPATH/bin to your $PATH.

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

Clone this repository to: $GOPATH/src/github.com/linode/terraform-provider-linode

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

Enter the provider directory and build the provider

cd $GOPATH/src/github.com/linode/terraform-provider-linode
make

Testing the provider

In order to run the full suite of Acceptance tests, run make int-test. Acceptance testing will require the LINODE_TOKEN variable to be populated with a Linode APIv4 Token. See Linode Provider documentation for more details.

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

make int-test

Use the following command template to execute specific Acceptance test

make ARGS="-run TestAccResourceVolume_basic" int-test

Use the following command template to execute particular Acceptance tests within a specific package

make TEST_TAGS="volume" int-test

There are a number of useful flags and variables to aid in debugging.

These values (along with LINODE_TOKEN) can be placed in a .env file in the repository root to avoid repeating them on the command line.

To filter down to logs relevant to the Linode provider, the following command can be used:

terraform apply 2> >(grep '@module=linode' >&2)