Closed relvira closed 10 months ago
@relvira thank you once again for your contribution. We will review this soon and get back to you. I want to make sure that this works as expected.
@relvira I'm afraid just updating the module version isn't enough to make this work. You'll have to work on adding the schema for the third party notifications. Have a look at https://github.com/thousandeyes/terraform-provider-thousandeyes/blob/main/thousandeyes/schemas.go#L790
Hey @pedro-te! my apologies for being slow to respond as I've been on holidays. I've made a new commit with the updated schema for third party notifications. I'm not super familiar with your API spec so take a look at it and let me know if there's anything else that needs updating.
Thanks for your help! 🙇🏼
Hi @pedro-te 👋🏼 have you had a chance to review my latest changes?
Hi @pedro-te 👋🏼 have you had a chance to review my latest changes?
Hey @relvira ! Thank you for updating the PR. We will review this and get back to you as soon as possible.
Hi @pedro-te 👋🏼 have you had a chance to review my latest changes?
Hey @relvira ! Thank you for updating the PR. We will review this and get back to you as soon as possible.
@relvira this is a bit more complex to implement than we thought as we will have to filter out some of the fields that our own API returns to Terraform in order to have the same behaviour in terraform as we have using the API when creating new alert rules. I discussed this with my team and we will be implementing this ourselves. Please stand by for updates from us!
Thank you once again for your contribution!
Thanks @pedro-te for getting back to me. Would you happen to know an estimate for when these provider changes from your team will land? having an estimate will help me figure out when we'll be able to continue with the work we are intending to do with your provider.
Thanks again for your support!
Thanks @pedro-te for getting back to me. Would you happen to know an estimate for when these provider changes from your team will land? having an estimate will help me figure out when we'll be able to continue with the work we are intending to do with your provider.
Thanks again for your support!
@relvira I will work on this next week, hopefully we will have an update for you sometime next week. I will keep you updated. Please don't hesitate to reach out, will do my best to get back to you as soon as possible.
Thank you!
Hey @relvira !
Good news:
Can you give it a try and let me know if it works for you, please?
Thank you for your patience!
Great news @pedro-te!! I'll work on upgrading the provider to 1.3.0 on our side and let you know how everything goes. Thank you so much for getting this out so quickly, I appreciate it!
Hi @pedro-te apologies for the delay as I am just testing this now. I am seeing some issues when applying my changes (tf plan didn't yield any problems).
6:42:45 module.thousandeyes-dns.thousandeyes_alert_rule.dnssec_alert_rule: Creating...
16:42:46
16:42:46 Error: rpc error: code = Unavailable desc = transport is closing
16:42:46
16:42:46
16:42:46
16:42:46 Error: rpc error: code = Unavailable desc = transport is closing
16:42:46
16:42:46
16:42:46 panic: interface conversion: interface {} is map[string]interface {}, not *schema.Set
16:42:46 2022-10-18T07:42:45.859-0700 [DEBUG] plugin.terraform-provider-thousandeyes:
16:42:46 2022-10-18T07:42:45.859-0700 [DEBUG] plugin.terraform-provider-thousandeyes: goroutine 11 [running]:
16:42:46 2022-10-18T07:42:45.859-0700 [DEBUG] plugin.terraform-provider-thousandeyes: github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*MapFieldWriter).setSet(0xc00000cd20, {0xc00041eab0, 0x3, 0xc00041e960}, {0xb15e80, 0xc00041e870}, 0xc0003cf2c0)
16:42:46 2022-10-18T07:42:45.859-0700 [DEBUG] plugin.terraform-provider-thousandeyes: github.com/hashicorp/terraform-plugin-sdk/v2@v2.17.0/helper/schema/field_writer_map.go:343 +0x7b4
16:42:46 2022-10-18T07:42:45.859-0700 [DEBUG] plugin.terraform-provider-thousandeyes: github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*MapFieldWriter).set(0xc00000cd20, {0xc00041eab0, 0x3, 0x3}, {0xb15e80, 0xc00041e870})
16:42:46 2022-10-18T07:42:45.859-0700 [DEBUG] plugin.terraform-provider-thousandeyes: github.com/hashicorp/terraform-plugin-sdk/v2@v2.17.0/helper/schema/field_writer_map.go:107 +0x14c
16:42:46 2022-10-18T07:42:45.859-0700 [DEBUG] plugin.terraform-provider-thousandeyes: github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*MapFieldWriter).setObject(0xc000484840, {0xc000484840, 0x2, 0x2}, {0xb15e80, 0xc00041e840})
16:42:46 2022-10-18T07:42:45.859-0700 [DEBUG] plugin.terraform-provider-thousandeyes: github.com/hashicorp/terraform-plugin-sdk/v2@v2.17.0/helper/schema/field_writer_map.go:222 +0x30c
16:42:46 2022-10-18T07:42:45.859-0700 [DEBUG] plugin.terraform-provider-thousandeyes: github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*MapFieldWriter).set(0xc00000cd20, {0xc000484840, 0x2, 0x2}, {0xb15e80, 0xc00041e840})
16:42:46 2022-10-18T07:42:45.859-0700 [DEBUG] plugin.terraform-provider-thousandeyes: github.com/hashicorp/terraform-plugin-sdk/v2@v2.17.0/helper/schema/field_writer_map.go:109 +0x11c
16:42:46 2022-10-18T07:42:45.859-0700 [DEBUG] plugin.terraform-provider-thousandeyes: github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*MapFieldWriter).setList.func1(...)
16:42:46 2022-10-18T07:42:45.859-0700 [DEBUG] plugin.terraform-provider-thousandeyes: github.com/hashicorp/terraform-plugin-sdk/v2@v2.17.0/helper/schema/field_writer_map.go:122
16:42:46 2022-10-18T07:42:45.859-0700 [DEBUG] plugin.terraform-provider-thousandeyes: github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*MapFieldWriter).setList(0xc00000cd20, {0xc0002614f0, 0x1, 0x1}, {0xad3ea0, 0xc00000cd08})
16:42:46 2022-10-18T07:42:45.859-0700 [DEBUG] plugin.terraform-provider-thousandeyes: github.com/hashicorp/terraform-plugin-sdk/v2@v2.17.0/helper/schema/field_writer_map.go:142 +0x52a
16:42:46 2022-10-18T07:42:45.859-0700 [DEBUG] plugin.terraform-provider-thousandeyes: github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*MapFieldWriter).set(0xc00000cd20, {0xc0002614f0, 0x1, 0x1}, {0xad3ea0, 0xc00000cd08})
16:42:46 2022-10-18T07:42:45.859-0700 [DEBUG] plugin.terraform-provider-thousandeyes: github.com/hashicorp/terraform-plugin-sdk/v2@v2.17.0/helper/schema/field_writer_map.go:103 +0xa5
16:42:46 2022-10-18T07:42:45.859-0700 [DEBUG] plugin.terraform-provider-thousandeyes: github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*MapFieldWriter).WriteField(0xc00000cd20, {0xc0002614f0, 0x1, 0x1}, {0xad3ea0, 0xc00000cd08})
16:42:46 2022-10-18T07:42:45.859-0700 [DEBUG] plugin.terraform-provider-thousandeyes: github.com/hashicorp/terraform-plugin-sdk/v2@v2.17.0/helper/schema/field_writer_map.go:89 +0x3f9
16:42:46 2022-10-18T07:42:45.859-0700 [DEBUG] plugin.terraform-provider-thousandeyes: github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*MapFieldWriter).setSet(0xc0002a8798, {0xc0002614f0, 0x1, 0xc0003f9080}, {0xad3ea0, 0xc00000cd08}, 0xc0003cf7c0)
16:42:46 2022-10-18T07:42:45.859-0700 [DEBUG] plugin.terraform-provider-thousandeyes: github.com/hashicorp/terraform-plugin-sdk/v2@v2.17.0/helper/schema/field_writer_map.go:306 +0x346
16:42:46 2022-10-18T07:42:45.859-0700 [DEBUG] plugin.terraform-provider-thousandeyes: github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*MapFieldWriter).set(0xc0002a8798, {0xc0002614f0, 0x1, 0x1}, {0xad3ea0, 0xc00000cd08})
16:42:46 2022-10-18T07:42:45.859-0700 [DEBUG] plugin.terraform-provider-thousandeyes: github.com/hashicorp/terraform-plugin-sdk/v2@v2.17.0/helper/schema/field_writer_map.go:107 +0x14c
16:42:46 2022-10-18T07:42:45.859-0700 [DEBUG] plugin.terraform-provider-thousandeyes: github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*MapFieldWriter).WriteField(0xc0002a8798, {0xc0002614f0, 0x1, 0x1}, {0xad3ea0, 0xc00000cd08})
16:42:46 2022-10-18T07:42:45.859-0700 [DEBUG] plugin.terraform-provider-thousandeyes: github.com/hashicorp/terraform-plugin-sdk/v2@v2.17.0/helper/schema/field_writer_map.go:89 +0x3f9
16:42:46 2022-10-18T07:42:45.859-0700 [DEBUG] plugin.terraform-provider-thousandeyes: github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ResourceData).Set(0xc000202380, {0xc00059f5c0, 0xd}, {0xad3ea0, 0xc00000cd08})
16:42:46 2022-10-18T07:42:45.859-0700 [DEBUG] plugin.terraform-provider-thousandeyes: github.com/hashicorp/terraform-plugin-sdk/v2@v2.17.0/helper/schema/resource_data.go:227 +0x21c
16:42:46 2022-10-18T07:42:45.859-0700 [DEBUG] plugin.terraform-provider-thousandeyes: github.com/thousandeyes/terraform-provider-thousandeyes/thousandeyes.ResourceRead(0xc00059eed0, {0xb1f3a0, 0xc0004a0400})
16:42:46 2022-10-18T07:42:45.859-0700 [DEBUG] plugin.terraform-provider-thousandeyes: github.com/thousandeyes/terraform-provider-thousandeyes/thousandeyes/util.go:146 +0x348
16:42:46 2022-10-18T07:42:45.859-0700 [DEBUG] plugin.terraform-provider-thousandeyes: github.com/thousandeyes/terraform-provider-thousandeyes/thousandeyes.resourceAlertRuleRead(0xc000202380, {0xbe9cc0, 0xc000410680})
16:42:46 2022-10-18T07:42:45.859-0700 [DEBUG] plugin.terraform-provider-thousandeyes: github.com/thousandeyes/terraform-provider-thousandeyes/thousandeyes/resource_alert_rule.go:36 +0x1d9
16:42:46 2022-10-18T07:42:45.859-0700 [DEBUG] plugin.terraform-provider-thousandeyes: github.com/thousandeyes/terraform-provider-thousandeyes/thousandeyes.resourceAlertRuleCreate(0xc000202380, {0xbe9cc0, 0xc000410680})
16:42:46 2022-10-18T07:42:45.859-0700 [DEBUG] plugin.terraform-provider-thousandeyes: github.com/thousandeyes/terraform-provider-thousandeyes/thousandeyes/resource_alert_rule.go:97 +0x285
16:42:46 2022-10-18T07:42:45.860-0700 [DEBUG] plugin.terraform-provider-thousandeyes: github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0xcf98a0, {0xcf98a0, 0xc000590f00}, 0xd, {0xbe9cc0, 0xc000410680})
16:42:46 2022-10-18T07:42:45.860-0700 [DEBUG] plugin.terraform-provider-thousandeyes: github.com/hashicorp/terraform-plugin-sdk/v2@v2.17.0/helper/schema/resource.go:695 +0x178
16:42:46 2022-10-18T07:42:45.860-0700 [DEBUG] plugin.terraform-provider-thousandeyes: github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc000133c00, {0xcf98a0, 0xc000590f00}, 0xc00021b860, 0xc000202180, {0xbe9cc0, 0xc000410680})
16:42:46 2022-10-18T07:42:45.860-0700 [DEBUG] plugin.terraform-provider-thousandeyes: github.com/hashicorp/terraform-plugin-sdk/v2@v2.17.0/helper/schema/resource.go:837 +0xc29
16:42:46 2022-10-18T07:42:45.860-0700 [DEBUG] plugin.terraform-provider-thousandeyes: github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc00011d878, {0xcf97f8, 0xc00068f500}, 0xc0005ae0a0)
16:42:46 2022-10-18T07:42:45.860-0700 [DEBUG] plugin.terraform-provider-thousandeyes: github.com/hashicorp/terraform-plugin-sdk/v2@v2.17.0/helper/schema/grpc_provider.go:1021 +0xe3c
16:42:46 2022-10-18T07:42:45.860-0700 [DEBUG] plugin.terraform-provider-thousandeyes: github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc00033cbe0, {0xcf98a0, 0xc000733ec0}, 0xc000360000)
16:42:46 2022-10-18T07:42:45.860-0700 [DEBUG] plugin.terraform-provider-thousandeyes: github.com/hashicorp/terraform-plugin-go@v0.9.1/tfprotov5/tf5server/server.go:812 +0x56b
16:42:46 2022-10-18T07:42:45.860-0700 [DEBUG] plugin.terraform-provider-thousandeyes: github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0xbb9a40, 0xc00033cbe0}, {0xcf98a0, 0xc000733ec0}, 0xc0006a83c0, 0x0)
16:42:46 2022-10-18T07:42:45.860-0700 [DEBUG] plugin.terraform-provider-thousandeyes: github.com/hashicorp/terraform-plugin-go@v0.9.1/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:385 +0x170
16:42:46 2022-10-18T07:42:45.860-0700 [DEBUG] plugin.terraform-provider-thousandeyes: google.golang.org/grpc.(*Server).processUnaryRPC(0xc000144700, {0xd06ba0, 0xc00048a1a0}, 0xc0002ca240, 0xc0003f9590, 0x11d3b40, 0x0)
16:42:46 2022-10-18T07:42:45.860-0700 [DEBUG] plugin.terraform-provider-thousandeyes: google.golang.org/grpc@v1.46.0/server.go:1283 +0xcf2
16:42:46 2022-10-18T07:42:45.860-0700 [DEBUG] plugin.terraform-provider-thousandeyes: google.golang.org/grpc.(*Server).handleStream(0xc000144700, {0xd06ba0, 0xc00048a1a0}, 0xc0002ca240, 0x0)
16:42:46 2022-10-18T07:42:45.860-0700 [DEBUG] plugin.terraform-provider-thousandeyes: google.golang.org/grpc@v1.46.0/server.go:1620 +0xa2a
16:42:46 2022-10-18T07:42:45.860-0700 [DEBUG] plugin.terraform-provider-thousandeyes: google.golang.org/grpc.(*Server).serveStreams.func1.2()
16:42:46 2022-10-18T07:42:45.860-0700 [DEBUG] plugin.terraform-provider-thousandeyes: google.golang.org/grpc@v1.46.0/server.go:922 +0x98
16:42:46 2022-10-18T07:42:45.860-0700 [DEBUG] plugin.terraform-provider-thousandeyes: created by google.golang.org/grpc.(*Server).serveStreams.func1
16:42:46 2022-10-18T07:42:45.860-0700 [DEBUG] plugin.terraform-provider-thousandeyes: google.golang.org/grpc@v1.46.0/server.go:920 +0x294
16:42:46 2022-10-18T07:42:45.861-0700 [WARN] plugin.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = transport is closing"
16:42:46 2022-10-18T07:42:45.861-0700 [DEBUG] plugin: plugin process exited: path=.terraform/providers/registry.terraform.io/thousandeyes/thousandeyes/1.3.0/linux_amd64/terraform-provider-thousandeyes pid=26978 error="exit status 2"
16:42:46 2022/10/18 07:42:45 [DEBUG] module.thousandeyes-dns.thousandeyes_alert_rule.dnssec_alert_rule: apply errored, but we're indicating that via the Error pointer rather than returning it: rpc error: code = Unavailable desc = transport is closing
16:42:46 2022/10/18 07:42:45 [TRACE] EvalMaybeTainted: module.thousandeyes-dns.thousandeyes_alert_rule.dnssec_alert_rule encountered an error during creation, so it is now marked as tainted
16:42:46 2022/10/18 07:42:45 [DEBUG] module.thousandeyes-dns.thousandeyes_alert_rule.dns_alert_rule: apply errored, but we're indicating that via the Error pointer rather than returning it: rpc error: code = Unavailable desc = transport is closing
16:42:46 2022/10/18 07:42:45 [TRACE] EvalWriteState: removing state object for module.thousandeyes-dns.thousandeyes_alert_rule.dnssec_alert_rule
16:42:46 2022/10/18 07:42:45 [TRACE] EvalApplyProvisioners: thousandeyes_alert_rule.dnssec_alert_rule has no state, so skipping provisioners
16:42:46 2022/10/18 07:42:45 [TRACE] EvalMaybeTainted: module.thousandeyes-dns.thousandeyes_alert_rule.dns_alert_rule encountered an error during creation, so it is now marked as tainted
16:42:46 2022/10/18 07:42:45 [TRACE] EvalMaybeTainted: module.thousandeyes-dns.thousandeyes_alert_rule.dnssec_alert_rule encountered an error during creation, so it is now marked as tainted
16:42:46 2022/10/18 07:42:45 [TRACE] EvalWriteState: removing state object for module.thousandeyes-dns.thousandeyes_alert_rule.dns_alert_rule
16:42:46 2022/10/18 07:42:45 [TRACE] EvalWriteState: removing state object for module.thousandeyes-dns.thousandeyes_alert_rule.dnssec_alert_rule
16:42:46 2022/10/18 07:42:45 [TRACE] EvalApplyProvisioners: thousandeyes_alert_rule.dns_alert_rule has no state, so skipping provisioners
16:42:46 2022/10/18 07:42:45 [TRACE] EvalMaybeTainted: module.thousandeyes-dns.thousandeyes_alert_rule.dns_alert_rule encountered an error during creation, so it is now marked as tainted
16:42:46 2022/10/18 07:42:45 [TRACE] EvalWriteState: removing state object for module.thousandeyes-dns.thousandeyes_alert_rule.dns_alert_rule
16:42:46 2022/10/18 07:42:45 [TRACE] vertex "module.thousandeyes-dns.thousandeyes_alert_rule.dnssec_alert_rule": visit complete
16:42:46 2022/10/18 07:42:45 [TRACE] vertex "module.thousandeyes-dns.thousandeyes_alert_rule.dns_alert_rule": visit complete
16:42:46 2022/10/18 07:42:45 [TRACE] dag/walk: upstream of "module.thousandeyes-dns.thousandeyes_dns_server.dns_lookup" errored, so skipping
16:42:46 2022/10/18 07:42:45 [TRACE] dag/walk: upstream of "module.thousandeyes-dns.provider[\"registry.terraform.io/thousandeyes/thousandeyes\"] (close)" errored, so skipping
This is my tf code:
## Alert Rules
resource "thousandeyes_alert_rule" "dns_alert_rule" {
rule_name = "${var.domain_name} ${var.domain_type} DNS (TF)"
alert_type = "DNS Server"
expression = "((probDetail != \"\"))"
minimum_sources_pct = var.alert_minimum_sources_pct
rounds_violating_out_of = var.alert_rounds_violating_out_of
rounds_violating_required = var.alert_rounds_violating_required
notifications {
dynamic "third_party" {
for_each = var.notifications
content {
integration_id = third_party.value.integration_id
integration_type = third_party.value.integration_type
}
}
}
}
resource "thousandeyes_alert_rule" "dnssec_alert_rule" {
rule_name = "${var.domain_name} ${var.dnssec_domain_type} DNSSEC (TF)"
alert_type = "DNSSEC"
expression = "((probDetail != \"\"))"
minimum_sources_pct = var.alert_minimum_sources_pct
rounds_violating_out_of = var.alert_rounds_violating_out_of
rounds_violating_required = var.alert_rounds_violating_required
notifications {
dynamic "third_party" {
for_each = var.notifications
content {
integration_id = third_party.value.integration_id
integration_type = third_party.value.integration_type
}
}
}
}
that's just the alert bit of a terraform module, which is called like this (you can see the data structure of notifications:
module "thousandeyes-dns" {
source = ".../thousandeyes-dns"
domain_name = "foobar.com"
domain_type = "A"
dnssec = false
alerts_enabled = true
notifications = [
{
integration_id = "XXX",
integration_type = "SLACK"
},
{
integration_id = "XXX",
integration_type = "PAGER_DUTY"
}
]
}
Hope this is helpful! 🙇🏼
Hi @relvira ,
I'm sorry you experienced this issue. We have released version 1.3.1 which fixes this issue exactly. Could you try again with that version and let me know if you still see this issue?
Thank you, Pedro
Closed as main has the updated sdk version
github.com/thousandeyes/thousandeyes-sdk-go/v2 v2.4.1
Hey there
terraform-provider-thousandeyes
maintainers 👋🏼A new version of
thousandeyes-sdk-go
has been released (v2.2.0), this PR updates the dependency on the SDK to the latest version so the T.E terraform provider can make use of new features in the SDK.The above mentioned release only contains https://github.com/thousandeyes/thousandeyes-sdk-go/pull/110 as far as I know.
go test looks good:
Please let me know if there is anything else needed. 🙇🏼