DefectDojo API Terraform Provider
- Clone the repository
- Enter the repository directory
- Build the provider using the Go
install
command:
go install
This provider uses Go modules. Please see the Go documentation for the most up to date information about using Go modules.
To add a new dependency github.com/author/dependency
to your Terraform provider:
go get github.com/author/dependency
go mod tidy
Then commit the changes to go.mod
and go.sum
.
You can configure the provider via environment variables:
$ export DEFECTDOJO_BASEURL="https://demo.defectdojo.org"
$ export DEFECTDOJO_APIKEY="my-api-key"
Or with a username/password:
$ export DEFECTDOJO_BASEURL="https://demo.defectdojo.org"
$ export DEFECTDOJO_USERNAME="admin"
$ export DEFECTDOJO_PASSWORD="ebgngrguvegrra"
Or in the terraform configuration:
provider "defectdojo" {
base_url = "https://defectdojo.my-company.com"
api_key = var.dd_api_key # don't put your key in the code!
}
provider "defectdojo" {
base_url = "https://defectdojo.my-company.com"
username = "admin"
password = var.dd_password # don't put your password in the code!
}
Start using resources:
data "defectdojo_product_type" "this" {
name = "My Product Type"
}
resource "defectdojo_product" "this" {
name = var.product_name
description = "This product represents is named `${var.product_name}`"
product_type_id = data.defectdojo_product_type.this.id
}
If you wish to work on the provider, you'll first need Go installed on your machine (see Requirements above).
To compile the provider, run go install
. This will build the provider and put the provider binary in the $GOPATH/bin
directory.
To generate or update documentation, run go generate
.
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
Run one test at a time:
TESTARGS="-run TestFunctionName" make testacc
Extra debug output:
TF_LOG="DEBUG" make testacc
Create a branch/pull-request named something like prepare for release v0.0.1
. Update the CHANGELOG.md file.
Merge your changes to master
and then push a version tag to master, like:
$ git checkout master
$ git pull
$ git tag v0.0.1
$ git push --tags
You can release a pre-release version from any commit. Just name the tag with a suffix:
$ git checkout something
$ git tag v0.0.1-pre
$ git push --tags
Pull requests are welcome. By contributing to this repository you are agreeing to the Contributor License Agreement (CONTRIBUTING.md)
Licensed under the Apache v2 license. See LICENSE.txt