To use the Megaport API, this Provider requires that a Megaport API access token
is provided. To simplify the process of obtaining a new access token, there is a
utility tool you can use. It is recommended that the token is provided via the
MEGAPORT_TOKEN
environment variable.
To retrieve a new token for the megaport api and export it as a variable:
$ export $(make reset-token)
Alternatively, you can use the helper tool directly:
$ cd util/megaport_token
$ go run .
To revoke the current token (and get a new one) you can pass the --reset
flag.
By default, the above script will obtain a token to use with megaport staging
api environment. You can set MEGAPORT_ENDPOINT
environment variable to specify
an alternative endpoint. For example, to get a token for megaport production
api, you can use the above target as:
MEGAPORT_ENDPOINT=https://api.megaport.com make reset-token
If you wish to work on the provider, you'll first need Go installed on your machine (please check the requirements before proceeding).
$ git clone https://github.com/utilitywarehouse/terraform-provider-megaport.git
...
$ cd terraform-provider-megaport
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-megaport
...
You can simply use the provider published in the Terraform Registry here to manage your terraform resources.
To use a custom-built provider in your Terraform environment (e.g. the provider
binary from the build instructions above), follow the instructions to
install it as a plugin.
After placing the custom-built provider into your plugins directory,
run terraform init
to initialize it.
To browse the documentation, you can simply make website
to serve it locally.
$ make website
...
Additionally, there are a number of templated examples (used in acceptance
testing) inside the examples/
directory.
In order to test the provider, you can 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. By default, acceptance tests for this provider are run in the staging Megaport environment which does not incur any costs.
$ make testacc
Terraform is the work of thousands of contributors. We appreciate your help!
To contribute, please read the contribution guidelines: Contributing to Terraform - Megaport Provider
GitHub issues are intended for bugs or feature requests related to the Megaport provider codebase. See https://www.terraform.io/docs/extend/community/index.html for a list of community resources to ask questions about Terraform.