Skip to content

Commit

Permalink
Merge pull request #179 from sleuth-io/jmalovrh/sd-8430-terraform-v06
Browse files Browse the repository at this point in the history
SD-8430: Terraform provider v0.6
  • Loading branch information
jdoklovic authored Aug 28, 2024
2 parents 5dfb65f + aa685f1 commit 31e7ea1
Show file tree
Hide file tree
Showing 44 changed files with 405 additions and 3,361 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
# Allow goreleaser to access older tag information.
fetch-depth: 0
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version-file: 'go.mod'
cache: true
Expand All @@ -32,7 +32,7 @@ jobs:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0
uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0
with:
args: release --clean
env:
Expand Down
29 changes: 12 additions & 17 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,27 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version-file: 'go.mod'
cache: true
- run: go mod download
- run: go build -v .
# unused until we remove the old code for 0.6 version
# - name: Run linters
# uses: golangci/golangci-lint-action@38e1018663fa5173f3968ea0777460d3de38f256 # v5.3.0
# with:
# version: latest
- name: Run linters
uses: golangci/golangci-lint-action@38e1018663fa5173f3968ea0777460d3de38f256 # v5.3.0
with:
version: latest

generate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version-file: 'go.mod'
cache: true
# Temporarily download Terraform 1.8 prerelease for function documentation support.
# When Terraform 1.8.0 final is released, this can be removed.
- uses: hashicorp/setup-terraform@v3.1.2
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
with:
terraform_wrapper: false
- run: go generate ./...
Expand All @@ -62,8 +59,6 @@ jobs:
matrix:
# list whatever Terraform versions here you would like to support
terraform:
- '0.14.11'
- '0.15.5'
- '1.0.11'
- '1.1.9'
- '1.2.9'
Expand All @@ -74,12 +69,12 @@ jobs:
- '1.7.5'
- '1.8.3'
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version-file: 'go.mod'
cache: true
- uses: hashicorp/setup-terraform@651471c36a6092792c552e8b1bef71e592b462d8 # v3.1.1
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
with:
terraform_version: ${{ matrix.terraform }}
terraform_wrapper: false
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## 0.5.0 (May 21, 2024)
## 0.5.1 (May 21, 2024)
ENHANCEMENTS:
- [#168](https://github.com/sleuth-io/terraform-provider-sleuth/pull/168) Update tooling
- [#169](https://github.com/sleuth-io/terraform-provider-sleuth/pull/169) Update documentation
Expand Down
64 changes: 33 additions & 31 deletions docs/resources/code_change_source.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,22 @@ Sleuth code change source.
resource "sleuth_code_change_source" "sleuth-terraform-provider" {
project_slug = "example_tf_app"
name = "terraform-provider-sleuth"
repository {
repository = {
name = "terraform-provider-sleuth"
owner = "sleuth-io"
provider = "GITHUB"
url = "https://github.com/sleuth-io/terraform-provider-sleuth"
}
environment_mappings {
environment_slug = "prod"
branch = "main"
}
environment_mappings {
environment_slug = "stage"
branch = "dev"
}
environment_mappings = [
{
environment_slug = "prod"
branch = "main"
},
{
environment_slug = "stage"
branch = "dev"
}
]
deploy_tracking_type = "manual"
collect_impact = true
path_prefix = jsonencode({
Expand All @@ -47,24 +49,41 @@ resource "sleuth_code_change_source" "sleuth-terraform-provider" {
- `deploy_tracking_type` (String) How to track deploys. Valid choices are build, manual, auto_pr, auto_tag, auto_push
- `name` (String) Code change source name
- `project_slug` (String) The slug of the project that this code change source belongs to.
- `repository` (Attributes) Repository details (see [below for nested schema](#nestedatt--repository))

### Optional

- `auto_tracking_delay` (Number) The delay to add to a deployment event
- `build_mappings` (Block List) Build mappings of the code change source. They must be ordered by environment_slug ascending to avoid Terraform plan changes. (see [below for nested schema](#nestedblock--build_mappings))
- `build_mappings` (Attributes List) Build mappings of the code change source. They must be ordered by environment_slug ascending to avoid Terraform plan changes. (see [below for nested schema](#nestedatt--build_mappings))
- `collect_impact` (Boolean) Whether to collect impact for its deploys
- `environment_mappings` (Block List) Environment mappings of the code change source. They must be ordered by environment_slug ascending to avoid Terraform plan changes. (see [below for nested schema](#nestedblock--environment_mappings))
- `environment_mappings` (Attributes List) Environment mappings of the code change source. They must be ordered by environment_slug ascending to avoid Terraform plan changes. (see [below for nested schema](#nestedatt--environment_mappings))
- `include_in_dashboard` (Boolean) Whether to include deploys from this change source in the metrics dashboard
- `notify_in_slack` (Boolean) Whether to send Slack notifications for deploys or not
- `path_prefix` (String) What code source path to limit this deployment to. Useful for monorepos. Must be used with the [jsonencode()](https://developer.hashicorp.com/terraform/language/functions/jsonencode) function to specify the paths to include and/or exclude respectively. (see example above)
- `repository` (Block, Optional) (see [below for nested schema](#nestedblock--repository))

### Read-Only

- `id` (String) The ID of this resource.
- `slug` (String)

<a id="nestedblock--build_mappings"></a>
<a id="nestedatt--repository"></a>
### Nested Schema for `repository`

Required:

- `name` (String) The repository name
- `owner` (String) The repository owner, usually the organization or user name
- `provider` (String) The repository provider, options: AZURE, BITBUCKET, CUSTOM_GIT, GITHUB, GITHUB_ENTERPRISE, GITLAB
- `url` (String) The repository URL, used for links

Optional:

- `integration_slug` (String) IntegrationAuthentication slug used
- `project_uid` (String) Project UID, required only for AZURE provider. You can obtain data from [API](https://learn.microsoft.com/en-us/rest/api/azure/devops/git/repositories/list?view=azure-devops-rest-6.0&tabs=HTTP)
- `repo_uid` (String) Repository UID, required only for AZURE provider. You can obtain data from [API](https://learn.microsoft.com/en-us/rest/api/azure/devops/git/repositories/list?view=azure-devops-rest-6.0&tabs=HTTP)


<a id="nestedatt--build_mappings"></a>
### Nested Schema for `build_mappings`

Required:
Expand All @@ -81,7 +100,7 @@ Optional:
- `project_key` (String) The build project key


<a id="nestedblock--environment_mappings"></a>
<a id="nestedatt--environment_mappings"></a>
### Nested Schema for `environment_mappings`

Required:
Expand All @@ -92,20 +111,3 @@ Required:
Read-Only:

- `id` (String) Computed ID


<a id="nestedblock--repository"></a>
### Nested Schema for `repository`

Required:

- `name` (String) The repository name
- `owner` (String) The repository owner, usually the organization or user name
- `provider` (String) The repository provider, options: AZURE, BITBUCKET, CUSTOM_GIT, GITHUB, GITHUB_ENTERPRISE, GITLAB
- `url` (String) The repository URL, used for links

Optional:

- `integration_slug` (String) IntegrationAuthentication slug used
- `project_uid` (String) Project UID, required only for AZURE provider. You can obtain data from [API](https://learn.microsoft.com/en-us/rest/api/azure/devops/git/repositories/list?view=azure-devops-rest-6.0&tabs=HTTP)
- `repo_uid` (String) Repository UID, required only for AZURE provider. You can obtain data from [API](https://learn.microsoft.com/en-us/rest/api/azure/devops/git/repositories/list?view=azure-devops-rest-6.0&tabs=HTTP)
66 changes: 33 additions & 33 deletions docs/resources/incident_impact_source.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ resource "sleuth_incident_impact_source" "pd" {
project_slug = "project_slug"
name = "PagerDuty TF incident impact"
environment_name = "environment_name"
provider_name = "PAGERDUTY"
pagerduty_input {
provider_name = "pagerduty"
pagerduty_input = {
remote_services = ""
remote_urgency = "ANY"
}
Expand All @@ -28,8 +28,8 @@ resource "sleuth_incident_impact_source" "dd" {
project_slug = "project_slug"
name = "DataDog TF incident impact"
environment_name = "environment_name"
provider_name = "DATADOG"
datadog_input {
provider_name = "datadog"
datadog_input = {
query = "@query=123" # use @ if you are using facets in DataDog
remote_priority_threshold = "ALL" # or P1 to P5
integration_slug = "optional_integration_slug"
Expand All @@ -40,8 +40,8 @@ resource "sleuth_incident_impact_source" "jira" {
project_slug = "project_slug"
name = "JIRA TF incident impact"
environment_name = "environment_name"
provider_name = "JIRA"
jira_input {
provider_name = "jira"
jira_input = {
remote_jql = "status IN (\"Incident\")"
integration_slug = "optional_integration_slug"
}
Expand All @@ -51,8 +51,8 @@ resource "sleuth_incident_impact_source" "blameless" {
project_slug = "project_slug"
name = "Blameless TF incident impact"
environment_name = "environment_name"
provider_name = "BLAMELESS"
blameless_input {
provider_name = "blameless"
blameless_input = {
remote_types = ["type1", "type2"]
remote_severity_threshold = "SEV1"
integration_slug = "optional_integration_slug"
Expand All @@ -63,8 +63,8 @@ resource "sleuth_incident_impact_source" "statuspage" {
project_slug = "project_slug"
name = "Statuspage TF incident impact"
environment_name = "environment_name"
provider_name = "STATUSPAGE"
statuspage_input {
provider_name = "statuspage"
statuspage_input = {
remote_page = "remote_page"
remote_component = "remote_component"
remote_impact = "remote_impact"
Expand All @@ -76,8 +76,8 @@ resource "sleuth_incident_impact_source" "opsgenie" {
project_slug = "project_slug"
name = "OpsGenie TF incident impact"
environment_name = "environment_name"
provider_name = "OPSGENIE"
opsgenie_input {
provider_name = "opsgeanie"
opsgenie_input = {
remote_alert_tags = "tag1"
remote_incidents_tags = "tag1"
remote_priority_threshold = "P1"
Expand All @@ -90,8 +90,8 @@ resource "sleuth_incident_impact_source" "firehydrant" {
project_slug = "project_slug"
name = "FireHydrant TF incident impact"
environment_name = "environment_name"
provider_name = "FIREHYDRANT"
opsgenie_input {
provider_name = "firehydrant"
firehydrant_input = {
remote_services = "service_uuid"
remote_environments = "environment_uuid"
remote_mitigated_is_healthy = true
Expand All @@ -102,8 +102,8 @@ resource "sleuth_incident_impact_source" "clubhouse" {
project_slug = "project_slug"
name = "Clubhouse TF incident impact"
environment_name = "environment_name"
provider_name = "CLUBHOUSE"
clubhouse_input {
provider_name = "clubhouse"
clubhouse_input = {
remote_query = "id:135"
integration_slug = "optional_integration_slug"
}
Expand All @@ -118,25 +118,25 @@ resource "sleuth_incident_impact_source" "clubhouse" {
- `environment_name` (String) Impact source environment name
- `name` (String) Impact source name
- `project_slug` (String) The slug of the project that this incident impact source belongs to.
- `provider_name` (String) Impact source provider (options: PAGERDUTY)
- `provider_name` (String) Impact source provider in lowercase (options: pagerduty, datadog, jira, blameless, statuspage, opsgenie, firehydrant, clubhouse)

### Optional

- `blameless_input` (Block, Optional) Blameless input (see [below for nested schema](#nestedblock--blameless_input))
- `clubhouse_input` (Block, Optional) Clubhouse input (see [below for nested schema](#nestedblock--clubhouse_input))
- `datadog_input` (Block, Optional) DataDog input (see [below for nested schema](#nestedblock--datadog_input))
- `firehydrant_input` (Block, Optional) FireHydrant input (see [below for nested schema](#nestedblock--firehydrant_input))
- `jira_input` (Block, Optional) JIRA input (see [below for nested schema](#nestedblock--jira_input))
- `opsgenie_input` (Block, Optional) OpsGenie input (see [below for nested schema](#nestedblock--opsgenie_input))
- `pagerduty_input` (Block, Optional) PagerDuty input (see [below for nested schema](#nestedblock--pagerduty_input))
- `statuspage_input` (Block, Optional) Statuspage input (see [below for nested schema](#nestedblock--statuspage_input))
- `blameless_input` (Attributes) Blameless input (see [below for nested schema](#nestedatt--blameless_input))
- `clubhouse_input` (Attributes) Clubhouse input (see [below for nested schema](#nestedatt--clubhouse_input))
- `datadog_input` (Attributes) DataDog input (see [below for nested schema](#nestedatt--datadog_input))
- `firehydrant_input` (Attributes) FireHydrant input (see [below for nested schema](#nestedatt--firehydrant_input))
- `jira_input` (Attributes) JIRA input (see [below for nested schema](#nestedatt--jira_input))
- `opsgenie_input` (Attributes) OpsGenie input (see [below for nested schema](#nestedatt--opsgenie_input))
- `pagerduty_input` (Attributes) PagerDuty input (see [below for nested schema](#nestedatt--pagerduty_input))
- `statuspage_input` (Attributes) Statuspage input (see [below for nested schema](#nestedatt--statuspage_input))

### Read-Only

- `id` (String) The ID of this resource.
- `slug` (String)

<a id="nestedblock--blameless_input"></a>
<a id="nestedatt--blameless_input"></a>
### Nested Schema for `blameless_input`

Optional:
Expand All @@ -146,7 +146,7 @@ Optional:
- `remote_types` (Set of String) The types of incidents to the monitors should track


<a id="nestedblock--clubhouse_input"></a>
<a id="nestedatt--clubhouse_input"></a>
### Nested Schema for `clubhouse_input`

Optional:
Expand All @@ -155,7 +155,7 @@ Optional:
- `remote_query` (String) Need help finding query expression? See the [documentation](https://help.shortcut.com/hc/en-us/articles/360000046646-Searching-in-Shortcut-Using-Search-Operators) for more information.


<a id="nestedblock--datadog_input"></a>
<a id="nestedatt--datadog_input"></a>
### Nested Schema for `datadog_input`

Optional:
Expand All @@ -167,7 +167,7 @@ See [DataDog documentation](https://docs.datadoghq.com/monitors/manage/search/)
Options: ALL, P1, P2, P3, P4, P5. Defaults to ALL


<a id="nestedblock--firehydrant_input"></a>
<a id="nestedatt--firehydrant_input"></a>
### Nested Schema for `firehydrant_input`

Optional:
Expand All @@ -180,7 +180,7 @@ Read-Only:
- `remote_mitigated_is_healthy` (Boolean) If true, incident considered to have ended once reaching mitigated Milestone or it is resolved


<a id="nestedblock--jira_input"></a>
<a id="nestedatt--jira_input"></a>
### Nested Schema for `jira_input`

Optional:
Expand All @@ -189,7 +189,7 @@ Optional:
- `remote_jql` (String) JIRA active incidents issues JQL


<a id="nestedblock--opsgenie_input"></a>
<a id="nestedatt--opsgenie_input"></a>
### Nested Schema for `opsgenie_input`

Optional:
Expand All @@ -202,7 +202,7 @@ Optional:
- `remote_use_alerts` (Boolean) Use OpsGenie Alerts instead of Incidents


<a id="nestedblock--pagerduty_input"></a>
<a id="nestedatt--pagerduty_input"></a>
### Nested Schema for `pagerduty_input`

Optional:
Expand All @@ -212,7 +212,7 @@ Optional:
- `remote_urgency` (String) PagerDuty remote urgency, options: HIGH, LOW, ANY


<a id="nestedblock--statuspage_input"></a>
<a id="nestedatt--statuspage_input"></a>
### Nested Schema for `statuspage_input`

Optional:
Expand Down
Loading

0 comments on commit 31e7ea1

Please sign in to comment.