Skip to content

Commit f6b662e

Browse files
fixed a permadiff in google_monitoring_uptime_check_config.http_check.path (#5818) (#11301)
Signed-off-by: Modular Magician <[email protected]>
1 parent 4194856 commit f6b662e

4 files changed

+16
-8
lines changed

.changelog/5818.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:bug
2+
monitoring: fixed a permadiff when `google_monitoring_uptime_check_config.http_check.path` does not begin with "/"
3+
```

google/resource_monitoring_uptime_check_config.go

+10-5
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ import (
2424
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
2525
)
2626

27+
func resourceMonitoringUptimeCheckConfigHttpCheckPathDiffSuppress(k, old, new string, d *schema.ResourceData) bool {
28+
return old == "/"+new
29+
}
30+
2731
func resourceMonitoringUptimeCheckConfig() *schema.Resource {
2832
return &schema.Resource{
2933
Create: resourceMonitoringUptimeCheckConfigCreate,
@@ -128,11 +132,12 @@ func resourceMonitoringUptimeCheckConfig() *schema.Resource {
128132
AtLeastOneOf: []string{"http_check.0.auth_info", "http_check.0.port", "http_check.0.headers", "http_check.0.path", "http_check.0.use_ssl", "http_check.0.mask_headers"},
129133
},
130134
"path": {
131-
Type: schema.TypeString,
132-
Optional: true,
133-
Description: `The path to the page to run the check against. Will be combined with the host (specified within the MonitoredResource) and port to construct the full URL. Optional (defaults to "/").`,
134-
Default: "/",
135-
AtLeastOneOf: []string{"http_check.0.auth_info", "http_check.0.port", "http_check.0.headers", "http_check.0.path", "http_check.0.use_ssl", "http_check.0.mask_headers"},
135+
Type: schema.TypeString,
136+
Optional: true,
137+
DiffSuppressFunc: resourceMonitoringUptimeCheckConfigHttpCheckPathDiffSuppress,
138+
Description: `The path to the page to run the check against. Will be combined with the host (specified within the MonitoredResource) and port to construct the full URL. If the provided path does not begin with "/", a "/" will be prepended automatically. Optional (defaults to "/").`,
139+
Default: "/",
140+
AtLeastOneOf: []string{"http_check.0.auth_info", "http_check.0.port", "http_check.0.headers", "http_check.0.path", "http_check.0.use_ssl", "http_check.0.mask_headers"},
136141
},
137142
"port": {
138143
Type: schema.TypeInt,

google/resource_monitoring_uptime_check_config_generated_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ resource "google_monitoring_uptime_check_config" "http" {
5555
timeout = "60s"
5656
5757
http_check {
58-
path = "/some-path"
58+
path = "some-path"
5959
port = "8010"
6060
request_method = "POST"
6161
content_type = "URL_ENCODED"

website/docs/r/monitoring_uptime_check_config.html.markdown

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ resource "google_monitoring_uptime_check_config" "http" {
4343
timeout = "60s"
4444
4545
http_check {
46-
path = "/some-path"
46+
path = "some-path"
4747
port = "8010"
4848
request_method = "POST"
4949
content_type = "URL_ENCODED"
@@ -214,7 +214,7 @@ The following arguments are supported:
214214

215215
* `path` -
216216
(Optional)
217-
The path to the page to run the check against. Will be combined with the host (specified within the MonitoredResource) and port to construct the full URL. Optional (defaults to "/").
217+
The path to the page to run the check against. Will be combined with the host (specified within the MonitoredResource) and port to construct the full URL. If the provided path does not begin with "/", a "/" will be prepended automatically. Optional (defaults to "/").
218218

219219
* `use_ssl` -
220220
(Optional)

0 commit comments

Comments
 (0)