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

Updates to resource meraki_networks seems to trigger updates to resources using its output. #181

Open
3 tasks done
finkjordanj opened this issue Nov 20, 2024 · 3 comments

Comments

@finkjordanj
Copy link

Prerequisites

  • Have you tested the operation in the API directly?
  • Do you have the latest Terraform provider version?
  • Review the compatibility matrix before opening an issue.

Describe the bug
When updating the notes of the meraki_networks resource

resource "meraki_networks" "this" {
  name            = var.site_name
  notes           = var.site_notes
  organization_id = var.org_id
  product_types   = var.network_hardware

  lifecycle {
    ignore_changes = [tags]
  }
}

Any subsequent resources I leverage the output of the network_id (id) output appears to be triggering a recompute of all the resources for the network_id input.

Expected behavior
If the only update to the meraki_networks is the notes, then that resource would update, while all the subsequent using that ID as its input, will remain unaffected.

Screenshots
This is the change showing my update to in theory just the notes on the resource.
image

This shows my terraform plan out showing all my nested resources in my module having to do computed update?
image

Debug
The major debug that appears to be related is most the resources give this output or similar to their specific resource in question.

2024-11-20T15:48:17.690Z [DEBUG] provider.terraform-provider-meraki_v0.2.12-alpha: Marking Computed attributes with null configuration values as unknown (known after apply) in the plan to prevent potential Terraform errors: @caller=github.com/hashicorp/[email protected]/internal/fwserver/server_planresourcechange.go:217 @module=sdk.framework tf_provider_addr=registry.terraform.io/CiscoDevNet/meraki tf_req_id=706fd5ed-c7ce-933a-1812-1d2ccab161b8 tf_resource_type=meraki_networks_appliance_firewall_port_forwarding_rules tf_rpc=PlanResourceChange timestamp=2024-11-20T15:48:17.690Z

Environment (please complete the following information):

  • Terraform version: 1.9.8
  • Meraki provider version: 0.2.12-alpha
  • OS Version: ubuntu 22.04

Additional context
Add any other context about the problem here.

@fmunozmiranda
Copy link
Collaborator

Hi @finkjordanj ,

Thank you for the information shared in this issue. However, I’d like to better understand the behavior you're describing and how it might be managed in my case.

Could you provide more details or additional examples to clarify how to handle this situation in Terraform? It would also be helpful if you could explain more thoroughly how Terraform manages dependencies and recomputation of resources, particularly when only metadata like notes is being updated, rather than actual network or infrastructure configurations.

If you'd prefer, we can set up a session to discuss it further and explore potential solutions together.

Please feel free to contact me at [email protected] to coordinate a call or session.

Thanks in advance for your time and help!

@finkjordanj
Copy link
Author

Here is a diagram of what we are attempting. Ill reach out to your email to go over additional details as needed.
My biggest assumption is based on the network_id being a meraki calculated value I would have no way to build that prior to hard define it within the state file vs just having Meraki make that lookup/store.
Since we aren't making a change that would require the network_id to be updated, the output shouldn't need to update and that value then passed either within the module for the resources using the meraki_network.this.id itself, our our output defined as module.name_of_module_at_call.network_id for our module and then also passed into our baseline module.

image

@finkjordanj
Copy link
Author

After a little more digging with a co-worker we think we found what is causing this. Due to us initially trying to use the id as the output/input for other resources in the module, the current setup doesn't have a planmodifiers to usestatefor unknown on the ID but does on the network_id. I think this was/is confusing on why this is separated and have different behaviors.

Since the ID was a read only value I'm assuming either the planmodifier check never really applies.
Can you confirm should the network_id output be used to pass into other resources or should we be using the read only value ID?

https://github.com/cisco-open/terraform-provider-meraki/blob/e8df2171270480df573c571709d69a3a041f94fb/internal/provider/resource_meraki_networks.go#L86C4-L93C6

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

No branches or pull requests

2 participants