Skip to content

Commit 1abdb78

Browse files
committed
fix: Use Terraform address to index resource + agent association (#1577)
This fixes resources created from Terraform modules not properly being associated with an agent. By not using the address, and resource identifiers prefixed with `module.<name>` would be missed!
1 parent de94f2d commit 1abdb78

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

provisioner/terraform/provision.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -357,11 +357,10 @@ func parseTerraformPlan(ctx context.Context, terraform *tfexec.Terraform, planfi
357357
if resource.Type == "coder_agent" || resource.Type == "coder_agent_instance" {
358358
continue
359359
}
360-
resourceKey := strings.Join([]string{resource.Type, resource.Name}, ".")
361360
resources = append(resources, &proto.Resource{
362361
Name: resource.Name,
363362
Type: resource.Type,
364-
Agents: findAgents(resourceDependencies, agents, resourceKey),
363+
Agents: findAgents(resourceDependencies, agents, resource.Address),
365364
})
366365
}
367366

@@ -498,8 +497,7 @@ func parseTerraformApply(ctx context.Context, terraform *tfexec.Terraform, state
498497
if resource.Type == "coder_agent" || resource.Type == "coder_agent_instance" {
499498
continue
500499
}
501-
resourceKey := strings.Join([]string{resource.Type, resource.Name}, ".")
502-
resourceAgents := findAgents(resourceDependencies, agents, resourceKey)
500+
resourceAgents := findAgents(resourceDependencies, agents, resource.Address)
503501
for _, agent := range resourceAgents {
504502
// Didn't use instance identity.
505503
if agent.GetToken() != "" {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy