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

Handling unresolvable references #446

Merged
merged 2 commits into from
Jan 15, 2021
Merged

Handling unresolvable references #446

merged 2 commits into from
Jan 15, 2021

Conversation

Kudbettin
Copy link
Member

@Kudbettin Kudbettin commented Jan 13, 2021

Addresses #424

I am not sure if this's a bug on upstream (terraform show), a bug on terraform-compliance, or a design shortcoming.

The reference in the plan is module.ecr_repository instead of module.ecr_repository.ecr_name. (Which can't be split into three and breaks)

Let's say you had the following inside your module

output "ecr_name" {
  value = aws_ecr_repository.ecr_repository.id
}
output "not_ecr_name" {
  value = 1234
}

how can terraform-compliance know if the code wants to reference ecr_name or not_ecr_name? It needs the third part of the reference.

(Both ecr_name and not_ecr_name appear in the plan once, so we can't look for them somewhere else in the plan)

How can the missing information be added to the reference?

Until we are able to answer that, this pr addresses the issue by mounting the resource to all resources within the target module and warns the user about it.

Other Ideas

  • Making the "workaround" optional with a flag. (Probably wouldn't be good)
  • Just dropping unresolved references

Quick note

  • In fact, module.ecr_repository.ecr_name would not be the correct reference either, since for_each names the resources differently. I wanted to describe it that way as it's somewhat less confusing.

@Kudbettin Kudbettin requested a review from eerkunt January 13, 2021 23:24
@Kudbettin Kudbettin marked this pull request as ready for review January 13, 2021 23:24
@Kudbettin Kudbettin added the bug label Jan 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants