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

Managing multi google_dns_record_set resources with same dns_name doesn't pop an error #10661

Closed
valtos opened this issue Dec 1, 2021 · 3 comments

Comments

@valtos
Copy link

valtos commented Dec 1, 2021

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.
  • If an issue is assigned to the modular-magician user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned to hashibot, a community member has claimed the issue already.

Terraform Version

Terraform v1.0.11

Affected Resource(s)

  • google_dns_record_set

Terraform Configuration Files

data "google_compute_network" "shared-vpc" {
  name    = var.vpc_name
  project = var.host_project_id
}

resource "google_dns_managed_zone" "test-internal_zone" {
  project     = var.host_project_id
  name        = "test-internal"
  dns_name    = "test.internal."

  visibility = "private"

  private_visibility_config {
    networks {
      network_url = data.google_compute_network.shared-vpc.self_link
    }
  }

}

resource "google_dns_record_set" "rr1" {
  name = "rr1.${google_dns_managed_zone.test-internal_zone.dns_name}"
  managed_zone = google_dns_managed_zone.test-internal_zone.name
  type = "A"
  ttl  = 300
  rrdatas = ["1.2.3.4"]
}

resource "google_dns_record_set" "rr2" {
  name = "rr1.${google_dns_managed_zone.test-internal_zone.dns_name}"
  managed_zone = google_dns_managed_zone.test-internal_zone.name
  type = "A"
  ttl  = 300
  rrdatas = ["1.2.3.5"]
}

Debug Output

I can't share the debug output because of confidential informations, it's a simple configuration easy to reproduce.

Expected Behavior

An error should say the resource already exists when creating another records with same dns_name.

Actual Behavior

If you create both records with same dns_name in same time, it create the first record then pop an error saying the dns_name already exists => This is normal behavior.

But if you create first record (with terraform apply) then second record (with another apply), the first record is just erased and replaced by second one ! without any error saying it already exists !

Steps to Reproduce

  1. Comment resource record block "google_dns_record_set" "rr2"
  2. terraform apply
  3. Unomment resource record block "google_dns_record_set" "rr2"
  4. terraform apply

b/319824590

@valtos valtos added the bug label Dec 1, 2021
@mabushey
Copy link

If you put both A records in the same rrdatas (rrdatas = [ "1.2.3.4", "1.2.3.5" ]) and apply, it will show ...Creating... for both IPs. Both IP's will be added to the A record in GCP. Terraform will show one of the IPs as Creation complete after 1s. The other IPs will error with │ Error: Error creating ResourceDnsRecordSet: googleapi: Error 409: The resource 'entity.rrset' named 'xxx.com. (A)' already exists, alreadyExists. It creates the records, but the state is all mangled.

@slevenick
Copy link
Collaborator

Closed via GoogleCloudPlatform/magic-modules#11622 by adding a mutex.

Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants