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

deletion of cname not always working #68

Open
Jeffote opened this issue Mar 10, 2024 · 2 comments
Open

deletion of cname not always working #68

Jeffote opened this issue Mar 10, 2024 · 2 comments

Comments

@Jeffote
Copy link

Jeffote commented Mar 10, 2024

The deletion of "pihole_dns_record" is not always working and leaves the entry in pihole untouched.

pihole version: v5.17.3
provider version: 0.2.0

@rustyguts
Copy link

I ran into this when trying to add or remove lots of cnames from a list, though I get it with A records too. I converted my list to a set which solved the deletion issue. Now, Terraform is smart enough to only add or remove the domains that have changed. It may not fix the underlying cause but it's a workaround.

# Old
resource "pihole_cname_record" "this" {
  count  = length(local.all_cnames)
  domain = local.all_cnames[count.index]
  target = "ingress.example.local"
}

# New
resource "pihole_cname_record" "this" {
  for_each = toset(local.all_cnames)
  domain   = each.key
  target   = "ingress.example.local"
}

@jlilja
Copy link
Contributor

jlilja commented Jul 13, 2024

Hi there! I believe I have a fix for this. Once the open PR(s) are accepted and merged, then I will rebase my PRs and create a new PR towards this repo.

My draft can be found here in the meantime jlilja#4

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

3 participants