Skip to content
This repository has been archived by the owner on Aug 3, 2022. It is now read-only.

pureport/terraform-provider-pureport

 
 

Repository files navigation

Terraform Provider

Maintainers

This provider plugin is maintained by the Pureport Inc, team at Pureport.

Requirements

  • Terraform 0.12.x
  • Go 1.13 (to build the provider plugin)

Usage

# For example, restrict pureport version in 1.1.2
provider "pureport" {
  version = "~> 1.1.2"
}

Building The Provider

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

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

Enter the provider directory and build the provider

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

Using the provider

3rd Party plugin installation

Copy the terraform-provider-pureport plugin in to the terraform third-party plugins directory.

OS Location
Windows %APPDATA%\terraform.d\plugins
All other systems ~/.terraform.d/plugins

More information about this can be found here.

Developing the Provider

If you wish to work on the provider, you'll first need Go installed on your machine (version 1.13+ 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-pureport
...

This provider uses golangci-lint for checking static analysis of the source code. This needs to be installed separate from the other golang modules required to build the provider.

$ make tools
$ make lint

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

If you want to run just a specific test in the acceptance test suite, override the TESTARGS paramter

$ make testacc TESTARGS='-run=TestResourceAWSConnection_basic'

You can also install the plugin which will build and copy the plugin to your terraform third party plugin directory. You'll need to re-initialize terraform in module directory after installing the new plugin.

$ make install
$ cd <some_module>/
$ terraform init

Acceptance Test Setup

When preparing to run the acceptance tests, some initial manual setup will be required for each cloud provider to ensure we are able to deploy the cloud infrastructure for testing.

An example environment setup script is available in this repository in examples/envsetup.sh.examples. You can modify this file with your cloud provider information and then source it in to your shell prior to deploying and running the acceptance tests.

After the credentials have been setup, you can run Terraform Configuration in test-infra to deploy the required cloud provider resources.

Azure

For Azure, you will need to create a Resource Group with the name "terraform-acceptance-tests" and also a Service Principle as instructed by the azurerm provider. Instructions can be found here.

After running the test infrastructure, please copy the service key from the output to your environment setup script. This will be needed for the acceptance tests.

Google Cloud

For Google Cloud, you will need to have a valid account and a project created that you can deploy resource in to.

AWS

For Amazon Web Services, you will need to have a valid IAM identity with permission to create resources.

Packages

No packages published

Languages

  • Go 90.6%
  • HCL 5.2%
  • Shell 1.8%
  • HTML 1.3%
  • Makefile 1.1%