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

fixed a permadiff in google_monitoring_uptime_check_config.http_check.path #4135

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
3 changes: 3 additions & 0 deletions .changelog/5818.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
monitoring: fixed a permadiff when `google_monitoring_uptime_check_config.http_check.path` does not begin with "/"
```
15 changes: 10 additions & 5 deletions google-beta/resource_monitoring_uptime_check_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

func resourceMonitoringUptimeCheckConfigHttpCheckPathDiffSuppress(k, old, new string, d *schema.ResourceData) bool {
return old == "/"+new
}

func resourceMonitoringUptimeCheckConfig() *schema.Resource {
return &schema.Resource{
Create: resourceMonitoringUptimeCheckConfigCreate,
Expand Down Expand Up @@ -128,11 +132,12 @@ func resourceMonitoringUptimeCheckConfig() *schema.Resource {
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"},
},
"path": {
Type: schema.TypeString,
Optional: true,
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 "/").`,
Default: "/",
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"},
Type: schema.TypeString,
Optional: true,
DiffSuppressFunc: resourceMonitoringUptimeCheckConfigHttpCheckPathDiffSuppress,
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 "/").`,
Default: "/",
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"},
},
"port": {
Type: schema.TypeInt,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ resource "google_monitoring_uptime_check_config" "http" {
timeout = "60s"

http_check {
path = "/some-path"
path = "some-path"
port = "8010"
request_method = "POST"
content_type = "URL_ENCODED"
Expand Down
4 changes: 2 additions & 2 deletions website/docs/r/monitoring_uptime_check_config.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ resource "google_monitoring_uptime_check_config" "http" {
timeout = "60s"

http_check {
path = "/some-path"
path = "some-path"
port = "8010"
request_method = "POST"
content_type = "URL_ENCODED"
Expand Down Expand Up @@ -214,7 +214,7 @@ The following arguments are supported:

* `path` -
(Optional)
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 "/").
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 "/").

* `use_ssl` -
(Optional)
Expand Down