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

azurerm_network_connection_monitor errors on cty.ObjectVal(map[string]cty.Value{"address":cty.StringVal("terraform.io") #22659

Open
1 task done
esdccs1 opened this issue Jul 24, 2023 · 4 comments

Comments

@esdccs1
Copy link

esdccs1 commented Jul 24, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment and review the contribution guide to help.

Terraform Version

1.3.9

AzureRM Provider Version

3.66

Affected Resource(s)/Data Source(s)

azurerm_network_connection_monitor

Terraform Configuration Files

resource "azurerm_network_connection_monitor" "example" {
  name               = "Test-Monitor"
  network_watcher_id = var.network_watcher_id
  location           = local.location

  endpoint {
    name = "source"
    target_resource_id = module.my_vm.vm_id
  }

  endpoint {
    name    = "destination"
    address = "terraform.io"
  }

  test_configuration {
    name                      = "tcpName"
    protocol                  = "Tcp"
    test_frequency_in_seconds = 60

    tcp_configuration {
      port = 80
    }
  }

  test_group {
    name                     = "exampletg"
    destination_endpoints    = ["destination"]
    source_endpoints         = ["source"]
    test_configuration_names = ["tcpName"]
  }

  notes = "note to describe reason of connection monitor"

  output_workspace_resource_ids = [data.azurerm_log_analytics_workspace.my_law.id]

  depends_on = [module.my_vm]
}

Debug Output/Panic Output

│ When expanding the plan for
│ module.connection_monitors.azurerm_network_connection_monitor.example to
│ include new values learned so far during apply, provider
│ "registry.terraform.io/hashicorp/azurerm" produced an invalid new value for
│ .endpoint: planned set element
│ cty.ObjectVal(map[string]cty.Value{"address":cty.StringVal("terraform.io"),
│ "coverage_level":cty.NullVal(cty.String),
│ "excluded_ip_addresses":cty.SetValEmpty(cty.String),
│ "filter":cty.ListValEmpty(cty.Object(map[string]cty.Type{"item":cty.Set(cty.Object(map[string]cty.Type{"address":cty.String,
│ "type":cty.String})), "type":cty.String})),
│ "included_ip_addresses":cty.SetValEmpty(cty.String),
│ "name":cty.StringVal("destination"),
│ "target_resource_id":cty.StringVal(""),
│ "target_resource_type":cty.NullVal(cty.String)}) does not correlate with
│ any element in actual.
│ 
│ This is a bug in the provider, which should be reported in the provider's
│ own issue tracker.

Expected Behaviour

no error messages telling me to submit a bug report.

Actual Behaviour

No response

Steps to Reproduce

No response

Important Factoids

No response

References

No response

@myc2h6o
Copy link
Contributor

myc2h6o commented Jul 25, 2023

@esdccs1 does this happen during create or update?
if it's an update, you may need to check if it's created with an older API version as described in the doc: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/network_connection_monitor

Any Network Connection Monitor resource created with API versions 2019-06-01 or earlier (v1) are now incompatible with Terraform, which now only supports v2.

For create scenario, could you check if there is multiple azurerm_network_connection_monitor resource configuring the same instance? Also suggest turn on the debug log https://developer.hashicorp.com/terraform/internals/debugging, which may contain more info for troubleshooting.

@esdccs1
Copy link
Author

esdccs1 commented Jul 25, 2023

@myc2h6o all these resources were all created yesterday in a development environment. The error only appears intermittently, and after another deployment pipeline is fired off, it successfully plans, then applys.

For create scenario, could you check if there is multiple azurerm_network_connection_monitor resource configuring the same instance?

Yes, in our configuration we are creating 3 connection_monitor resources that all use a single VM as their source endpoint, set to different destinations elsewhere on a network. The error shows up on all 3 , but it is the exact same error in the output.

The bug shows up on updating the resource, I haven't seen it on creation yet.

@myc2h6o
Copy link
Contributor

myc2h6o commented Aug 11, 2023

@esdccs1 while this might be an issue within the Terraform itself hashicorp/terraform-provider-aws#28191 (comment) (though unclear yet) While we doing further investigation, I'd suggest try with the latest Terraform version and see if it could resolve the issue

@esdccs1
Copy link
Author

esdccs1 commented Oct 20, 2023

We are using 3.78 azure provider and still getting this issue. Any update on the matter?

When we run terraform apply it randomly fails on these connection monitors resources.

here is a sample resource block... could it be it doesn't like the "-" character in the url address field?

resource "azurerm_network_connection_monitor" "my_dns_connection_monitor" {
  name               = "my-dns-connection-monitor"
  network_watcher_id = var.network_watcher_id
  location           = local.location

  endpoint {
    name = "source1"
    target_resource_id = local.my_vm_id
  }

  endpoint {
    name = "destination - mysite1000.foo-bar.net"
    address = "mysite1000.foo-bar.net"
  }

  test_configuration {
    name                      = "DnsTestConfig1"
    protocol                  = "Tcp"
    test_frequency_in_seconds = 30
    tcp_configuration {
      port = 53
    }
  }

  test_group {
    name                     = "my test group"
    source_endpoints         = ["source1"]
    destination_endpoints    = ["destination - mysite1000.foo-bar.net"]
    test_configuration_names = ["DnsTestConfig1"]
  }

  output_workspace_resource_ids = [data.azurerm_log_analytics_workspace.my_law.id]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants