From 78c3ffc60f9a6e96aa1463eee7c8943ee0f0ee41 Mon Sep 17 00:00:00 2001 From: Dimitrios Karagiannis Date: Tue, 18 Feb 2020 14:38:47 +0000 Subject: [PATCH 1/2] Fix formatting Signed-off-by: Dimitrios Karagiannis --- megaport/api/types.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/megaport/api/types.go b/megaport/api/types.go index 9ad9518..2ae31b0 100644 --- a/megaport/api/types.go +++ b/megaport/api/types.go @@ -487,7 +487,7 @@ func (c ProductAssociatedVxcResourcesCspConnectionVRouter) connectType() string return VxcConnectTypeVRouter } -type ProductAssociatedVxcResourcesCspConnectionVRouterInterfaces struct {} +type ProductAssociatedVxcResourcesCspConnectionVRouterInterfaces struct{} type ProductAssociatedVxcResourcesCspConnectionGcpMegaports struct { Port uint64 From 3ed7215e04e55bc1f4e014541d10b3a7cf2c359d Mon Sep 17 00:00:00 2001 From: Dimitrios Karagiannis Date: Tue, 18 Feb 2020 15:02:47 +0000 Subject: [PATCH 2/2] Add more information on building and using the provider Signed-off-by: Dimitrios Karagiannis --- README.md | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 90 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index f140fc8..8baa26e 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,100 @@ -# terraform-provider-megaport +# Terraform Provider for Megaport -*This project is a work in progress* +- [![Build Status](https://travis-ci.org/utilitywarehouse/terraform-provider-megaport.svg?branch=master)](https://travis-ci.org/utilitywarehouse/terraform-provider-megaport) -## Utilities +## Requirements -To retrieve a new token for the megaport api: -``` -$ eval $(make reset-token) +- [Terraform](https://www.terraform.io/downloads.html) 0.12+ +- [Go](https://golang.org/doc/install) 1.13 (to build the provider plugin) + +## Credentials + +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: +```sh +$ export $(make reset-token) ``` Alternatively, you can use the helper tool directly: -``` +```sh $ cd util/megaport_token $ go run . ``` To revoke the current token (and get a new one) you can pass the `--reset` flag. + + +## Developing the Provider + +If you wish to work on the provider, you'll first need +[Go](http://www.golang.org) installed on your machine (please check the +[requirements](#requirements) before proceeding). + +```sh +$ 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. + +```sh +$ make build +... +$ $GOPATH/bin/terraform-provider-megaport +... +``` + +## Using the Provider + +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](https://www.terraform.io/docs/plugins/basics.html#installing-plugins). +After placing the custom-built provider into your plugins directory, +run `terraform init` to initialize it. + +### Provider Documentation + +To browse the documentation, you can simply `make website` to serve it locally. + +```sh +$ make website +... +``` + +Additionally, there are a number of templated examples (used in acceptance +testing) inside the `examples/` directory. + +## Testing the Provider + +In order to test the provider, you can run `make test`. + +```sh +$ 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. + +```sh +$ make testacc +``` + +## Contributing + +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/CONTRIBUTING.md) + +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. +