Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: use resource_id directly for coder_metadata association #18300

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

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

sreya
Copy link
Collaborator

@sreya sreya commented Jun 10, 2025

Previously, coder_metadata resources would associate with the wrong Terraform resource because the implementation relied on graph traversal instead of using the explicit resource_id attribute.

This fix:

  • Builds a map from resource IDs to their labels for direct lookup
  • Uses the resource_id attribute to find the target resource directly
  • Falls back to graph traversal only if resource_id lookup fails
  • Adds logging when resource_id is not found in the state

This ensures that metadata is correctly associated with the intended resource, even when there are complex dependencies in the Terraform configuration.

Fixes the issue where coder_metadata would incorrectly associate with resources it references in its values rather than the resource specified in resource_id.

@sreya sreya force-pushed the jon/resourcemetadata branch from 439f812 to 558c1eb Compare June 10, 2025 03:41
@github-actions github-actions bot added the stale This issue is like stale bread. label Jun 20, 2025
@github-actions github-actions bot closed this Jun 23, 2025
@sreya sreya reopened this Jun 23, 2025
@github-actions github-actions bot removed the stale This issue is like stale bread. label Jun 24, 2025
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

Successfully merging this pull request may close these issues.

1 participant