Skip to content
This repository has been archived by the owner on Jun 18, 2024. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into MCTB-6735-merge
Browse files Browse the repository at this point in the history
  • Loading branch information
mwidera committed Feb 26, 2024
2 parents 408de51 + 620f5d2 commit 35782b8
Show file tree
Hide file tree
Showing 928 changed files with 85,955 additions and 1,125 deletions.
76 changes: 76 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,79 @@
## 3.8.1 (Feb 20, 2024)

IMPROVEMENTS:

* `pagerduty/pagerduty`: Fix go module name ([#616](https://github.com/PagerDuty/terraform-provider-pagerduty/pull/616))

## 3.8.0 (Feb 16, 2024)

FEATURES:

* `data/pagerduty_standards_resource_scores`, `data/pagerduty_standards_resources_scores`: Add datasource standards resource scores and standards resources scores ([#812](https://github.com/PagerDuty/terraform-provider-pagerduty/pull/812))

BUG FIXES:

* `resource/pagerduty_tag_assignment`: Address: pagerduty_tag_assignment teams change_tag 404 not found ([#818](https://github.com/PagerDuty/terraform-provider-pagerduty/pull/818))
* `resource/pagerduty_incident_workflow`: Fix import for incident workflow ([#820](https://github.com/PagerDuty/terraform-provider-pagerduty/pull/820))

IMPROVEMENTS:

* `resource/pagerduty_response_play`: Response play documentation EOL heads up ([#821](https://github.com/PagerDuty/terraform-provider-pagerduty/pull/821))

## 3.7.1 (Feb 6, 2024)

BUG FIXES:

* `resource/pagerduty_event_orchestration_router`: Address: Fail to enable rules in pagerduty_event_orchestration_router ([#814](https://github.com/PagerDuty/terraform-provider-pagerduty/pull/814))

## 3.7.0 (Jan 31, 2024)

FEATURES:

* `data/pagerduty_standards`: Add provider and a Standards datasource using Terraform Plugin Framework ([#787](https://github.com/PagerDuty/terraform-provider-pagerduty/pull/787))

## 3.6.0 (Jan 26, 2024)

FEATURES:

* `resource/*`, `data/*`: feat: support for sourcing the provider service region from env var (take 2) ([#805](https://github.com/PagerDuty/terraform-provider-pagerduty/pull/805))

IMPROVEMENTS:

* `resource/pagerduty_user`: Address permadiff when user name has repeated whitespaces ([#810](https://github.com/PagerDuty/terraform-provider-pagerduty/pull/810))

## 3.5.2 (Jan 25, 2024)

IMPROVEMENTS:

* `resource/*`, `data/*`: Address: timeout while waiting for state to become 'success' ([#807](https://github.com/PagerDuty/terraform-provider-pagerduty/pull/807))

## 3.5.1 (Jan 24, 2024)

BUG FIXES:

* `resource/*`, `data/*`: Revert "Support for sourcing the provider service region from env var" ([#804](https://github.com/PagerDuty/terraform-provider-pagerduty/pull/804))

## 3.5.0 (Jan 23, 2024)

FEATURES:

* `resource/*`, `data/*`: feat: support for sourcing the provider service region from an env var ([#797](https://github.com/PagerDuty/terraform-provider-pagerduty/pull/797))

IMPROVEMENTS:

* `resource/*`, `data/*`: Add API Client timeouts configuration for http transport ([#802](https://github.com/PagerDuty/terraform-provider-pagerduty/pull/802))

## 3.4.1 (Jan 18, 2024)

BUG FIXES:

* `resource/pagerduty_service_integration`: Fix attribute deprecation warning ([#801](https://github.com/PagerDuty/terraform-provider-pagerduty/pull/801))

IMPROVEMENTS:

* `resource/*`, `data/*`: Update go version to 1.20 ([#794](https://github.com/PagerDuty/terraform-provider-pagerduty/pull/794))
* `resource/pagerduty_service`: Allow time_window to be set for content-based grouping (issue 788) ([#795](https://github.com/PagerDuty/terraform-provider-pagerduty/pull/795))

## 3.4.0 (Dec 21, 2023)

FEATURES:
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,3 +208,4 @@ PAGERDUTY_ACC_SCHEDULE_USED_BY_EP_W_1_LAYER=1 make testacc TESTARGS="-run PagerD
| `PAGERDUTY_ACC_INCIDENT_CUSTOM_FIELDS` | Custom Fields |
| `PAGERDUTY_ACC_LICENSE_NAME` | Licenses |
| `PAGERDUTY_ACC_SCHEDULE_USED_BY_EP_W_1_LAYER` | Schedule |
| `PAGERDUTY_ACC_EXTERNAL_PROVIDER_VERSION` | Modifies the version used to compare plans between sdkv2 and framework implementations. Default `~> 3.6`. |
25 changes: 16 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module github.com/nordcloud/terraform-provider-pagerduty

go 1.20
go 1.21

toolchain go1.21.6

require (
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
Expand All @@ -9,7 +11,7 @@ require (
github.com/hashicorp/terraform-exec v0.20.0
github.com/hashicorp/terraform-json v0.20.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.31.0
github.com/nordcloud/go-pagerduty v1.5.1
github.com/nordcloud/go-pagerduty v1.5.3
)

require (
Expand All @@ -31,8 +33,12 @@ require (
github.com/hashicorp/go-uuid v1.0.3 // indirect
github.com/hashicorp/hcl/v2 v2.19.1 // indirect
github.com/hashicorp/logutils v1.0.0 // indirect
github.com/hashicorp/terraform-plugin-go v0.20.0 // indirect
github.com/hashicorp/terraform-plugin-framework v1.5.0 // indirect
github.com/hashicorp/terraform-plugin-framework-validators v0.12.0 // indirect
github.com/hashicorp/terraform-plugin-go v0.22.0 // indirect
github.com/hashicorp/terraform-plugin-log v0.9.0 // indirect
github.com/hashicorp/terraform-plugin-mux v0.15.0 // indirect
github.com/hashicorp/terraform-plugin-testing v1.6.0 // indirect
github.com/hashicorp/terraform-registry-address v0.2.3 // indirect
github.com/hashicorp/terraform-svchost v0.1.1 // indirect
github.com/hashicorp/yamux v0.1.1 // indirect
Expand All @@ -56,15 +62,16 @@ require (
github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a // indirect
github.com/zclconf/go-cty v1.14.1 // indirect
go.mongodb.org/mongo-driver v1.13.1 // indirect
golang.org/x/crypto v0.17.0 // indirect
golang.org/x/crypto v0.18.0 // indirect
golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819 // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/sync v0.5.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/net v0.20.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 // indirect
google.golang.org/grpc v1.60.1 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 // indirect
google.golang.org/grpc v1.62.0 // indirect
google.golang.org/protobuf v1.32.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
)
27 changes: 27 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,22 @@ github.com/hashicorp/terraform-exec v0.20.0 h1:DIZnPsqzPGuUnq6cH8jWcPunBfY+C+M8J
github.com/hashicorp/terraform-exec v0.20.0/go.mod h1:ckKGkJWbsNqFKV1itgMnE0hY9IYf1HoiekpuN0eWoDw=
github.com/hashicorp/terraform-json v0.20.0 h1:cJcvn4gIOTi0SD7pIy+xiofV1zFA3hza+6K+fo52IX8=
github.com/hashicorp/terraform-json v0.20.0/go.mod h1:qdeBs11ovMzo5puhrRibdD6d2Dq6TyE/28JiU4tIQxk=
github.com/hashicorp/terraform-plugin-framework v1.5.0 h1:8kcvqJs/x6QyOFSdeAyEgsenVOUeC/IyKpi2ul4fjTg=
github.com/hashicorp/terraform-plugin-framework v1.5.0/go.mod h1:6waavirukIlFpVpthbGd2PUNYaFedB0RwW3MDzJ/rtc=
github.com/hashicorp/terraform-plugin-framework-validators v0.12.0 h1:HOjBuMbOEzl7snOdOoUfE2Jgeto6JOjLVQ39Ls2nksc=
github.com/hashicorp/terraform-plugin-framework-validators v0.12.0/go.mod h1:jfHGE/gzjxYz6XoUwi/aYiiKrJDeutQNUtGQXkaHklg=
github.com/hashicorp/terraform-plugin-go v0.20.0 h1:oqvoUlL+2EUbKNsJbIt3zqqZ7wi6lzn4ufkn/UA51xQ=
github.com/hashicorp/terraform-plugin-go v0.20.0/go.mod h1:Rr8LBdMlY53a3Z/HpP+ZU3/xCDqtKNCkeI9qOyT10QE=
github.com/hashicorp/terraform-plugin-go v0.22.0 h1:1OS1Jk5mO0f5hrziWJGXXIxBrMe2j/B8E+DVGw43Xmc=
github.com/hashicorp/terraform-plugin-go v0.22.0/go.mod h1:mPULV91VKss7sik6KFEcEu7HuTogMLLO/EvWCuFkRVE=
github.com/hashicorp/terraform-plugin-log v0.9.0 h1:i7hOA+vdAItN1/7UrfBqBwvYPQ9TFvymaRGZED3FCV0=
github.com/hashicorp/terraform-plugin-log v0.9.0/go.mod h1:rKL8egZQ/eXSyDqzLUuwUYLVdlYeamldAHSxjUFADow=
github.com/hashicorp/terraform-plugin-mux v0.15.0 h1:+/+lDx0WUsIOpkAmdwBIoFU8UP9o2eZASoOnLsWbKME=
github.com/hashicorp/terraform-plugin-mux v0.15.0/go.mod h1:9ezplb1Dyq394zQ+ldB0nvy/qbNAz3mMoHHseMTMaKo=
github.com/hashicorp/terraform-plugin-sdk/v2 v2.31.0 h1:Bl3e2ei2j/Z3Hc2HIS15Gal2KMKyLAZ2om1HCEvK6es=
github.com/hashicorp/terraform-plugin-sdk/v2 v2.31.0/go.mod h1:i2C41tszDjiWfziPQDL5R/f3Zp0gahXe5No/MIO9rCE=
github.com/hashicorp/terraform-plugin-testing v1.6.0 h1:Wsnfh+7XSVRfwcr2jZYHsnLOnZl7UeaOBvsx6dl/608=
github.com/hashicorp/terraform-plugin-testing v1.6.0/go.mod h1:cJGG0/8j9XhHaJZRC+0sXFI4uzqQZ9Az4vh6C4GJpFE=
github.com/hashicorp/terraform-registry-address v0.2.3 h1:2TAiKJ1A3MAkZlH1YI/aTVcLZRu7JseiXNRHbOAyoTI=
github.com/hashicorp/terraform-registry-address v0.2.3/go.mod h1:lFHA76T8jfQteVfT7caREqguFrW3c4MFSPhZB7HHgUM=
github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S52uzrw4x0jKQ=
Expand Down Expand Up @@ -119,6 +129,8 @@ github.com/montanaflynn/stats v0.7.1 h1:etflOAAHORrCC44V+aR6Ftzort912ZU+YLiSTuV8
github.com/montanaflynn/stats v0.7.1/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow=
github.com/nordcloud/go-pagerduty v1.5.1 h1:J+162fkuPZvnWI6Z4NhwL8RT4NlyGVBVpvD/hv3H/B4=
github.com/nordcloud/go-pagerduty v1.5.1/go.mod h1:LWJ8UULUCQRQwzHrsEDGDEV9UmMgqk7ScB0pHb8hRcM=
github.com/nordcloud/go-pagerduty v1.5.3 h1:zYGyXZuQno00QDvJ3NK8pLGjG9nOmfkrrnYGu5j3F7s=
github.com/nordcloud/go-pagerduty v1.5.3/go.mod h1:LWJ8UULUCQRQwzHrsEDGDEV9UmMgqk7ScB0pHb8hRcM=
github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA=
github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU=
github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4=
Expand Down Expand Up @@ -161,6 +173,10 @@ golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2Uz
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k=
golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc=
golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg=
golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819 h1:EDuYyU/MkFXllv9QF9819VlI9a4tzGuCbhG0ExK9o1U=
golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0=
Expand All @@ -175,12 +191,16 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c=
golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U=
golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo=
golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE=
golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ=
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
Expand All @@ -200,12 +220,15 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4=
golang.org/x/term v0.16.0 h1:m+B6fahuftsE9qjo0VWp2FW0mB3MTJvR0BaMQrq0pmE=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
Expand All @@ -229,8 +252,12 @@ google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAs
google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 h1:6G8oQ016D88m1xAKljMlBOOGWDZkes4kMhgGFlf8WcQ=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917/go.mod h1:xtjpI3tXFPP051KaWnhvxkiubL/6dJ18vLVf7q2pTOU=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 h1:AjyfHzEPEFp/NpvfN5g+KDla3EMojjhRVZc1i7cj+oM=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80/go.mod h1:PAREbraiVEVGVdTZsVWjSbbTtSyGbAgIIvni8a8CD5s=
google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU=
google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM=
google.golang.org/grpc v1.62.0 h1:HQKZ/fa1bXkX1oFOvSjmZEUL8wLSaZTjCcLAlmZRtdk=
google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I=
Expand Down
26 changes: 24 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,28 @@ import (
)

func main() {
plugin.Serve(&plugin.ServeOpts{
ProviderFunc: pagerduty.Provider})
Serve()
}

func Serve() {
ctx := context.Background()

muxServer, err := tf5muxserver.NewMuxServer(
ctx,
// terraform-plugin-framework
providerserver.NewProtocol5(pagerdutyplugin.New()),
// terraform-plugin-sdk
pagerduty.Provider(pagerduty.IsMuxed).GRPCProvider,
)
if err != nil {
log.Fatal(err)
}

var serveOpts []tf5server.ServeOpt

address := "registry.terraform.io/pagerduty/pagerduty"
err = tf5server.Serve(address, muxServer.ProviderServer, serveOpts...)
if err != nil {
log.Fatal(err)
}
}
7 changes: 5 additions & 2 deletions pagerduty/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"log"
"net/http"
"sync"
"time"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/logging"
"github.com/nordcloud/go-pagerduty/pagerduty"
Expand Down Expand Up @@ -67,10 +68,12 @@ func (c *Config) Client() (*pagerduty.Client, error) {
return nil, fmt.Errorf(invalidCreds)
}

httpClient := http.DefaultClient
var httpClient *http.Client
httpClient = http.DefaultClient
httpClient.Timeout = 1 * time.Minute
httpClient.Transport = logging.NewTransport("PagerDuty", http.DefaultTransport)

var apiUrl = c.ApiUrl
apiUrl := c.ApiUrl
if c.ApiUrlOverride != "" {
apiUrl = c.ApiUrlOverride
}
Expand Down
12 changes: 8 additions & 4 deletions pagerduty/data_source_pagerduty_automation_actions_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"log"
"time"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

Expand Down Expand Up @@ -105,13 +105,17 @@ func dataSourcePagerDutyAutomationActionsActionRead(d *schema.ResourceData, meta

log.Printf("[INFO] Reading PagerDuty AutomationActionsAction")

return resource.Retry(1*time.Minute, func() *resource.RetryError {
return retry.Retry(2*time.Minute, func() *retry.RetryError {
automationActionsAction, _, err := client.AutomationActionsAction.Get(d.Get("id").(string))
if err != nil {
if isErrCode(err, http.StatusBadRequest) {
return retry.NonRetryableError(err)
}

// Delaying retry by 30s as recommended by PagerDuty
// https://developer.pagerduty.com/docs/rest-api-v2/rate-limiting/#what-are-possible-workarounds-to-the-events-api-rate-limit
time.Sleep(30 * time.Second)
return resource.RetryableError(err)
return retry.RetryableError(err)
}

d.SetId(automationActionsAction.ID)
Expand All @@ -126,7 +130,7 @@ func dataSourcePagerDutyAutomationActionsActionRead(d *schema.ResourceData, meta

f_adr := flattenActionDataReference(automationActionsAction.ActionDataReference)
if err := d.Set("action_data_reference", f_adr); err != nil {
return resource.NonRetryableError(err)
return retry.NonRetryableError(err)
}

if automationActionsAction.ModifyTime != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"fmt"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
"github.com/hashicorp/terraform-plugin-testing/helper/acctest"
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
"github.com/hashicorp/terraform-plugin-testing/terraform"
)

func TestAccDataSourcePagerDutyAutomationActionsAction_Basic(t *testing.T) {
Expand Down
10 changes: 7 additions & 3 deletions pagerduty/data_source_pagerduty_automation_actions_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"log"
"time"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

Expand Down Expand Up @@ -60,13 +60,17 @@ func dataSourcePagerDutyAutomationActionsRunnerRead(d *schema.ResourceData, meta

log.Printf("[INFO] Reading PagerDuty automation actions runner")

return resource.Retry(1*time.Minute, func() *resource.RetryError {
return retry.Retry(2*time.Minute, func() *retry.RetryError {
runner, _, err := client.AutomationActionsRunner.Get(d.Get("id").(string))
if err != nil {
if isErrCode(err, http.StatusBadRequest) {
return retry.NonRetryableError(err)
}

// Delaying retry by 30s as recommended by PagerDuty
// https://developer.pagerduty.com/docs/rest-api-v2/rate-limiting/#what-are-possible-workarounds-to-the-events-api-rate-limit
time.Sleep(30 * time.Second)
return resource.RetryableError(err)
return retry.RetryableError(err)
}

d.SetId(runner.ID)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"fmt"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
"github.com/hashicorp/terraform-plugin-testing/helper/acctest"
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
"github.com/hashicorp/terraform-plugin-testing/terraform"
)

func TestAccDataSourcePagerDutyAutomationActionsRunner_Basic(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions pagerduty/data_source_pagerduty_business_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"fmt"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
"github.com/hashicorp/terraform-plugin-testing/helper/acctest"
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
"github.com/hashicorp/terraform-plugin-testing/terraform"
)

func TestAccDataSourcePagerDutyBusinessService_Basic(t *testing.T) {
Expand Down
Loading

0 comments on commit 35782b8

Please sign in to comment.