https://github.com/doximity/terraform-provider-defectdojo
DefectDojo API Terraform Provider
https://github.com/doximity/terraform-provider-defectdojo
defectdojo go terraform
Last synced: 12 months ago
JSON representation
DefectDojo API Terraform Provider
- Host: GitHub
- URL: https://github.com/doximity/terraform-provider-defectdojo
- Owner: doximity
- License: other
- Created: 2022-04-01T23:08:47.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2025-01-24T18:11:38.000Z (over 1 year ago)
- Last Synced: 2025-04-01T16:33:42.399Z (over 1 year ago)
- Topics: defectdojo, go, terraform
- Language: Go
- Homepage:
- Size: 368 KB
- Stars: 5
- Watchers: 54
- Forks: 3
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.txt
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# terraform-provider-defectdojo
[DefectDojo API Terraform Provider](https://registry.terraform.io/providers/doximity/defectdojo)
## Requirements
- [Terraform](https://www.terraform.io/downloads.html) >= 1.0
- [Go](https://golang.org/doc/install) >= 1.17
## Building The Provider
1. Clone the repository
1. Enter the repository directory
1. Build the provider using the Go `install` command:
```shell
go install
```
## Adding Dependencies
This provider uses [Go modules](https://github.com/golang/go/wiki/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:
```shell
go get github.com/author/dependency
go mod tidy
```
Then commit the changes to `go.mod` and `go.sum`.
## Using the provider
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:
```hcl
provider "defectdojo" {
base_url = "https://defectdojo.my-company.com"
api_key = var.dd_api_key # don't put your key in the code!
}
```
```hcl
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
}
```
## Developing the Provider
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).
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.
```shell
make testacc
```
Run one test at a time:
```shell
TESTARGS="-run TestFunctionName" make testacc
```
Extra debug output:
```shell
TF_LOG="DEBUG" make testacc
```
## Releasing a new version
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
```
## Releasing a pre-release version
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
```
## Contributing
Pull requests are welcome. By contributing to this repository you are agreeing to the [Contributor License Agreement (CONTRIBUTING.md)](./CONTRIBUTING.md)
## Licencse
Licensed under the Apache v2 license. See [LICENSE.txt](./LICENSE.txt)