|
1 | | -# Terraform Provider Scaffolding |
2 | | - |
3 | | -This repository is a *template* for a [Terraform](https://www.terraform.io) provider. It is intended as a starting point for creating Terraform providers, containing: |
4 | | - |
5 | | - - A resource, and a data source (`internal/provider/`), |
6 | | - - Examples (`examples/`) and generated documentation (`docs/`), |
7 | | - - Miscellaneous meta files. |
8 | | - |
9 | | -These files contain boilerplate code that you will need to edit to create your own Terraform provider. A full guide to creating Terraform providers can be found at [Writing Custom Providers](https://www.terraform.io/docs/extend/writing-custom-providers.html). |
10 | | - |
11 | | -Please see the [GitHub template repository documentation](https://help.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-repository-from-a-template) for how to create a new repository from this template on GitHub. |
12 | | - |
13 | | -Once you've written your provider, you'll want to [publish it on the Terraform Registry](https://www.terraform.io/docs/registry/providers/publishing.html) so that others can use it. |
| 1 | +# Terraform Provider for Proofpoint - Meta Networks |
14 | 2 |
|
| 3 | +See the [Proofpoint - Meta Networks Provider documentation](docs/index.md) to get started using the provider. |
15 | 4 |
|
16 | 5 | ## Requirements |
17 | 6 |
|
18 | | -- [Terraform](https://www.terraform.io/downloads.html) >= 0.13.x |
19 | | -- [Go](https://golang.org/doc/install) >= 1.15 |
| 7 | +- [Terraform](https://www.terraform.io/downloads.html) 0.12.x or higher |
| 8 | +- [Go](https://golang.org/doc/install) >= 1.13 |
| 9 | +- [Goreleaser](https://goreleaser.com/install/) |
20 | 10 |
|
21 | 11 | ## Building The Provider |
22 | 12 |
|
23 | 13 | 1. Clone the repository |
24 | | -1. Enter the repository directory |
25 | | -1. Build the provider using the Go `install` command: |
| 14 | +2. Enter the repository directory |
| 15 | +3. Build the provider using the Go `install` command: |
26 | 16 | ```sh |
27 | 17 | $ go install |
28 | 18 | ``` |
29 | 19 |
|
30 | | -## Adding Dependencies |
| 20 | +## Developing the Provider |
| 21 | + |
| 22 | +### Adding Dependencies |
31 | 23 |
|
32 | 24 | This provider uses [Go modules](https://github.com/golang/go/wiki/Modules). |
33 | | -Please see the Go documentation for the most up to date information about using Go modules. |
| 25 | +Please see the Go documentation for the most up-to-date information about using Go modules. |
34 | 26 |
|
35 | 27 | To add a new dependency `github.com/author/dependency` to your Terraform provider: |
36 | 28 |
|
37 | | -``` |
38 | | -go get github.com/author/dependency |
39 | | -go mod tidy |
| 29 | +```sh |
| 30 | +$ go get github.com/author/dependency |
| 31 | +$ make mod-tidy |
40 | 32 | ``` |
41 | 33 |
|
42 | 34 | Then commit the changes to `go.mod` and `go.sum`. |
43 | 35 |
|
44 | | -## Using the provider |
| 36 | +If you wish to work on the provider, you'll first need [Go](http://www.golang.org) installed on your machine (see [Requirements](#requirements) above). |
| 37 | + |
| 38 | +To compile and run the provider locally run: |
| 39 | +```sh |
| 40 | +$ make debug-mode |
| 41 | +``` |
| 42 | +And then export the printed `TF_REATTACH_PROVIDERS` as env variable. |
45 | 43 |
|
46 | | -Fill this in for each provider |
| 44 | +This will compile the provider in debug mode and will allow you to execute terraform command with it. |
47 | 45 |
|
48 | | -## Developing the Provider |
| 46 | +### Documentation |
49 | 47 |
|
50 | | -If you wish to work on the provider, you'll first need [Go](http://www.golang.org) installed on your machine (see [Requirements](#requirements) above). |
| 48 | +In order to generate or update documentation, run `make generate`. |
51 | 49 |
|
52 | | -To compile the provider, run `go install`. This will build the provider and put the provider binary in the `$GOPATH/bin` directory. |
| 50 | +The documentation are auto-generated using the [docs generation tool](github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs) |
| 51 | +and are based on the resources descriptions in the schema and on the files in the `examples` folder |
53 | 52 |
|
54 | | -To generate or update documentation, run `go generate`. |
| 53 | +### Testing |
55 | 54 |
|
56 | | -In order to run the full suite of Acceptance tests, run `make testacc`. |
| 55 | +There are two types of tests that can be executed: |
| 56 | +- unit-tests |
| 57 | +- acceptance-tests |
57 | 58 |
|
58 | | -*Note:* Acceptance tests create real resources, and often cost money to run. |
| 59 | +Acceptance tests are expressed in terms of Test Cases, each using one or more Terraform configurations designed to create a set of resources under test, and then verify the actual infrastructure created. |
59 | 60 |
|
| 61 | +*Note:* Acceptance tests create real resources, and often cost money to run, see more about it [here](https://www.terraform.io/docs/extend/testing/acceptance-tests/testcase.html) |
| 62 | + |
| 63 | +In order to run the full suite of Acceptance tests: |
| 64 | +- Configure the authentication env variables or configuration file specified in [provider documentation](docs/index.md). |
| 65 | +- Execute: |
60 | 66 | ```sh |
61 | | -$ make testacc |
| 67 | +$ make acc_tests |
| 68 | +``` |
| 69 | + |
| 70 | +In order to tun unit-tests only run |
| 71 | +```shell |
| 72 | +$ make unittest |
62 | 73 | ``` |
| 74 | + |
0 commit comments