Skip to content
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

- Fix handling of `sys_monitoring` in `elasticstack_fleet_agent_policy` ([#792](https://github.com/elastic/terraform-provider-elasticstack/pull/792))
- Migrate `elasticstack_fleet_agent_policy`, `elasticstack_fleet_integration` (both), and `elasticstack_fleet_server_host` to terraform-plugin-framework ([#785](https://github.com/elastic/terraform-provider-elasticstack/pull/785))
- Fix for synthetics http/tcp monitor produces inconsistent result after apply ([#801](https://github.com/elastic/terraform-provider-elasticstack/pull/801))

## [0.11.7] - 2024-09-20

Expand Down
22 changes: 8 additions & 14 deletions internal/kibana/synthetics/acc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,9 @@ resource "elasticstack_kibana_synthetics_monitor" "%s" {
timeout = 30
http = {
url = "http://localhost:5601"
ssl_verification_mode = "full"
ssl_supported_protocols = ["TLSv1.0", "TLSv1.1", "TLSv1.2"]
mode = "any"
ipv4 = true
ipv6 = false
proxy_url = "http://localhost:8080"
}
}
`
Expand Down Expand Up @@ -128,9 +125,6 @@ resource "elasticstack_kibana_synthetics_monitor" "%s" {
timeout = 30
tcp = {
host = "http://localhost:5601"
ssl_verification_mode = "full"
ssl_supported_protocols = ["TLSv1.0", "TLSv1.1", "TLSv1.2"]
proxy_url = "http://localhost:8080"
proxy_use_local_resolver = true
}
}
Expand Down Expand Up @@ -302,14 +296,14 @@ func TestSyntheticMonitorHTTPResource(t *testing.T) {
resource.TestCheckResourceAttr(httpMonitorId, "http.url", "http://localhost:5601"),
resource.TestCheckResourceAttr(httpMonitorId, "http.ssl_verification_mode", "full"),
resource.TestCheckResourceAttr(httpMonitorId, "http.ssl_supported_protocols.#", "3"),
resource.TestCheckResourceAttr(httpMonitorId, "http.ssl_supported_protocols.0", "TLSv1.0"),
resource.TestCheckResourceAttr(httpMonitorId, "http.ssl_supported_protocols.1", "TLSv1.1"),
resource.TestCheckResourceAttr(httpMonitorId, "http.ssl_supported_protocols.2", "TLSv1.2"),
resource.TestCheckResourceAttr(httpMonitorId, "http.ssl_supported_protocols.0", "TLSv1.1"),
resource.TestCheckResourceAttr(httpMonitorId, "http.ssl_supported_protocols.1", "TLSv1.2"),
resource.TestCheckResourceAttr(httpMonitorId, "http.ssl_supported_protocols.2", "TLSv1.3"),
resource.TestCheckResourceAttr(httpMonitorId, "http.max_redirects", "0"),
resource.TestCheckResourceAttr(httpMonitorId, "http.mode", "any"),
resource.TestCheckResourceAttr(httpMonitorId, "http.ipv4", "true"),
resource.TestCheckResourceAttr(httpMonitorId, "http.ipv6", "false"),
resource.TestCheckResourceAttr(httpMonitorId, "http.proxy_url", "http://localhost:8080"),
resource.TestCheckResourceAttr(httpMonitorId, "http.proxy_url", ""),
),
},
// ImportState testing
Expand Down Expand Up @@ -402,10 +396,10 @@ func TestSyntheticMonitorTCPResource(t *testing.T) {
resource.TestCheckResourceAttr(tcpMonitorId, "tcp.host", "http://localhost:5601"),
resource.TestCheckResourceAttr(tcpMonitorId, "tcp.ssl_verification_mode", "full"),
resource.TestCheckResourceAttr(tcpMonitorId, "tcp.ssl_supported_protocols.#", "3"),
resource.TestCheckResourceAttr(tcpMonitorId, "tcp.ssl_supported_protocols.0", "TLSv1.0"),
resource.TestCheckResourceAttr(tcpMonitorId, "tcp.ssl_supported_protocols.1", "TLSv1.1"),
resource.TestCheckResourceAttr(tcpMonitorId, "tcp.ssl_supported_protocols.2", "TLSv1.2"),
resource.TestCheckResourceAttr(tcpMonitorId, "tcp.proxy_url", "http://localhost:8080"),
resource.TestCheckResourceAttr(tcpMonitorId, "tcp.ssl_supported_protocols.0", "TLSv1.1"),
resource.TestCheckResourceAttr(tcpMonitorId, "tcp.ssl_supported_protocols.1", "TLSv1.2"),
resource.TestCheckResourceAttr(tcpMonitorId, "tcp.ssl_supported_protocols.2", "TLSv1.3"),
resource.TestCheckResourceAttr(tcpMonitorId, "tcp.proxy_url", ""),
resource.TestCheckResourceAttr(tcpMonitorId, "tcp.proxy_use_local_resolver", "true"),
),
},
Expand Down
8 changes: 4 additions & 4 deletions internal/kibana/synthetics/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func (r *Resource) Create(ctx context.Context, request resource.CreateRequest, r
return
}

input, diags := plan.toKibanaAPIRequest()
input, diags := plan.toKibanaAPIRequest(ctx)
response.Diagnostics.Append(diags...)
if response.Diagnostics.HasError() {
return
Expand All @@ -33,9 +33,9 @@ func (r *Resource) Create(ctx context.Context, request resource.CreateRequest, r
return
}

plan, err = plan.toModelV0(result)
if err != nil {
response.Diagnostics.AddError("Failed to convert Kibana monitor API to TF state", err.Error())
plan, diags = plan.toModelV0(ctx, result)
response.Diagnostics.Append(diags...)
if response.Diagnostics.HasError() {
return
}

Expand Down
6 changes: 3 additions & 3 deletions internal/kibana/synthetics/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ func (r *Resource) Read(ctx context.Context, request resource.ReadRequest, respo
return
}

state, err = state.toModelV0(result)
if err != nil {
response.Diagnostics.AddError("Failed to convert Kibana monitor API to TF state", err.Error())
state, diags = state.toModelV0(ctx, result)
response.Diagnostics.Append(diags...)
if response.Diagnostics.HasError() {
return
}

Expand Down
Loading
Loading