Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Integration request to allow configuration access flag #440

Merged
merged 3 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18
Copy link
Contributor

@arjunrajpal arjunrajpal Jul 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The recommendation is based on the YAML parser's behavior, which interprets non-wrapped values as numbers and, in the case of version 1.20, trims it down to 1.2, which may not be very obvious.
So use quotes
https://github.com/actions/setup-go

go-version: '1.20'
-
name: Import GPG key
id: import_gpg
Expand All @@ -33,7 +33,7 @@ jobs:
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
args: release --clean
env:
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18
go-version: '1.20'
-
name: fmt check
run: make fmtcheck
Expand All @@ -28,4 +28,4 @@ jobs:
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: build --skip-validate --rm-dist
args: build --skip=validate --clean
4 changes: 2 additions & 2 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Visit https://goreleaser.com for documentation on how to customize this
# behavior.
version: 2
before:
hooks:
# this is just an example and not a requirement for provider building/publishing
Expand Down Expand Up @@ -58,6 +59,5 @@ signs:

release: # Visit your project's GitHub Releases page to publish this release.
draft: true

changelog:
skip: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

disable: true
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
module github.com/opsgenie/terraform-provider-opsgenie

go 1.18
go 1.20

require (
github.com/hashicorp/go-retryablehttp v0.6.6
github.com/hashicorp/terraform-plugin-sdk/v2 v2.10.0
github.com/opsgenie/opsgenie-go-sdk-v2 v1.2.22
github.com/opsgenie/opsgenie-go-sdk-v2 v1.2.23
github.com/pkg/errors v0.9.1
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,8 @@ github.com/nsf/jsondiff v0.0.0-20200515183724-f29ed568f4ce h1:RPclfga2SEJmgMmz2k
github.com/nsf/jsondiff v0.0.0-20200515183724-f29ed568f4ce/go.mod h1:uFMI8w+ref4v2r9jz+c9i1IfIttS/OkmLfrk1jne5hs=
github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw=
github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA=
github.com/opsgenie/opsgenie-go-sdk-v2 v1.2.22 h1:0h+YoXSyipf6XQGyIaDg6z5jwRik1JSm+sQetnD7vGY=
github.com/opsgenie/opsgenie-go-sdk-v2 v1.2.22/go.mod h1:4OjcxgwdXzezqytxN534MooNmrxRD50geWZxTD7845s=
github.com/opsgenie/opsgenie-go-sdk-v2 v1.2.23 h1:EFOD/cRfMeq+PCibHddoRTXu8CTN1m8Oj1Tk6eoz8Dw=
github.com/opsgenie/opsgenie-go-sdk-v2 v1.2.23/go.mod h1:1BK0BG3Mz//zeujilvvu3GJ0jnyZwFdT9XjznoPv6kk=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
Expand Down
23 changes: 16 additions & 7 deletions opsgenie/resource_opsgenie_api_integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ func resourceOpsgenieApiIntegration() *schema.Resource {
Optional: true,
Default: true,
},
"allow_configuration_access": {
Type: schema.TypeBool,
Optional: true,
Default: false,
},
"type": {
Type: schema.TypeString,
ForceNew: true,
Expand Down Expand Up @@ -120,6 +125,7 @@ func createApiIntegration(d *schema.ResourceData, meta interface{}) error {
}
name := d.Get("name").(string)
allowWriteAccess := d.Get("allow_write_access").(bool)
allowConfigurationAccess := d.Get("allow_configuration_access").(bool)
ignoreRespondersFromPayload := d.Get("ignore_responders_from_payload").(bool)
suppressNotifications := d.Get("suppress_notifications").(bool)
ownerTeam := d.Get("owner_team_id").(string)
Expand All @@ -134,6 +140,7 @@ func createApiIntegration(d *schema.ResourceData, meta interface{}) error {
Name: name,
Type: integrationType,
AllowWriteAccess: &allowWriteAccess,
AllowConfigurationAccess: &allowConfigurationAccess,
IgnoreRespondersFromPayload: &ignoreRespondersFromPayload,
SuppressNotifications: &suppressNotifications,
Responders: expandOpsgenieIntegrationResponders(d),
Expand Down Expand Up @@ -180,6 +187,7 @@ func createWebhookIntegration(d *schema.ResourceData, meta interface{}) error {
}
name := d.Get("name").(string)
allowWriteAccess := d.Get("allow_write_access").(bool)
allowConfigurationAccess := d.Get("allow_configuration_access").(bool)
suppressNotifications := d.Get("suppress_notifications").(bool)
ownerTeam := d.Get("owner_team_id").(string)
integrationType := d.Get("type").(string)
Expand All @@ -188,13 +196,14 @@ func createWebhookIntegration(d *schema.ResourceData, meta interface{}) error {
headers := expandOpsGenieWebhookHeaders(d)

createRequest := &integration.WebhookIntegrationRequest{
Name: name,
Type: integrationType,
AllowWriteAccess: &allowWriteAccess,
SuppressNotifications: &suppressNotifications,
Responders: expandOpsgenieIntegrationResponders(d),
WebhookUrl: webhookUrl,
Headers: headers,
Name: name,
Type: integrationType,
AllowWriteAccess: &allowWriteAccess,
AllowConfigurationAccess: &allowConfigurationAccess,
SuppressNotifications: &suppressNotifications,
Responders: expandOpsgenieIntegrationResponders(d),
WebhookUrl: webhookUrl,
Headers: headers,
}

if ownerTeam != "" {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/github.com/opsgenie/opsgenie-go-sdk-v2/og/entity.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ github.com/mitchellh/reflectwalk
# github.com/oklog/run v1.0.0
## explicit
github.com/oklog/run
# github.com/opsgenie/opsgenie-go-sdk-v2 v1.2.22
## explicit; go 1.12
# github.com/opsgenie/opsgenie-go-sdk-v2 v1.2.23
## explicit; go 1.16
github.com/opsgenie/opsgenie-go-sdk-v2/alert
github.com/opsgenie/opsgenie-go-sdk-v2/client
github.com/opsgenie/opsgenie-go-sdk-v2/contact
Expand Down
Loading