No description
  • Go 98.9%
  • HTML 0.6%
  • Makefile 0.3%
  • Shell 0.2%
Find a file
2020-07-22 11:02:04 -04:00
.github Make CoC and support channels more visible 2017-11-01 23:04:45 +01:00
datadog Merge pull request #587 from terraform-providers/therve/fix-pagerduty-tests 2020-07-21 18:44:06 +02:00
scripts Fix Changelog Links Script for datadog provider 2017-06-26 09:49:22 -05:00
vendor Update go client to beta7 2020-07-22 10:43:02 +02:00
version revert build flag, use hashis recommendation instead 2020-01-27 11:34:57 -05:00
website Update doc 2020-07-21 14:14:59 +02:00
.gitignore Add initial goreleaser configuration (#578) 2020-07-15 14:57:43 +02:00
.go-version provider: Ensured Go 1.11 in TravisCI and README 2019-03-11 19:02:56 -04:00
.goreleaser.yml Properly setup version.ProviderVersion when using goreleaser (#589) 2020-07-22 11:48:44 +02:00
.travis.yml deps: use go modules for dep mgmt 2019-03-11 19:02:56 -04:00
CHANGELOG.md Cleanup after v2.12.0 release 2020-07-22 13:30:47 +00:00
GNUmakefile increase timeout and add readonly url field to dashboard 2020-06-25 14:53:17 +02:00
go.mod Update go client to beta7 2020-07-22 10:43:02 +02:00
go.sum Update go client to beta7 2020-07-22 10:43:02 +02:00
LICENSE initial commit 2017-06-05 20:53:59 +00:00
main.go Migrate to terraform-plugin-sdk (#346) 2020-02-04 13:27:54 +01:00
README.md Update README.md 2020-07-22 11:02:04 -04:00

THIS REPOSITORY HAS MOVED TO https://github.com/DataDog/terraform-provider-datadog

Terraform Provider

Requirements

  • Terraform 0.10.x
  • Go 1.11 (to build the provider plugin)

Building The Provider

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

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

Enter the provider directory and build the provider

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

Note: For contributions created from forks, the repository should still be cloned under the $GOPATH/src/github.com/terraform-providers/terraform-provider-datadog directory to allow the provided make commands to properly run, build, and test this project.

Using the provider

If you're building the provider, follow the instructions to install it as a plugin. After placing it into your plugins directory, run terraform init to initialize it.

Further usage documentation is available on the Terraform website.

Developing the Provider

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

In order to test the provider, you can simply run make test.

$ make test

Note that the above command runs acceptance tests by replaying pre-recorded API responses (cassettes) stored in datadog/cassettes/. When tests are modified, the cassettes need to be re-recorded.

In order to make tests cassette friendly, it's necessary to ensure that resources always get manipulated in a predictable order. When creating a testing Terraform config that defines multiple resources at the same time, you need to set inter-resource dependencies (using depends_on) in such a way that there is only one way for Terraform to manipulate them. For example, given resources A, B and C in the same config string, you can achieve this by making A depend on B and B depend on C. See PR #442 for an example of this.

Note: Recording cassettes creates/updates/destroys real resources. Never run this on a production Datadog organization.

In order to re-record all cassettes you need to have DD_API_KEY and DD_APP_KEY for your testing organization in your environment. With that, run make cassettes. Do note that this would regenerate all cassettes and thus take a very long time; if you only need to re-record cassettes for one or two tests, you can run make cassettes TESTARGS ="-run XXX" - this will effectively execute go test -run=XXX, which would run all testcases that contain XXX in their name.

In order to run the full suite of Acceptance tests, run make testacc.

Note: Acceptance tests create/update/destroy real resources. Never run this on a production Datadog organization.

$ make testacc

In order to update the underlying API Clients that are used by this provider to interact with the Datadog API, run:

API_CLIENT_VERSION=vx.y.z ZORKIAN_VERSION=vx.y.z make update-go-client

where: