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

google_dns_record_set don't update resource from single A record to WRR #12486

Closed
Demacr opened this issue Sep 7, 2022 · 7 comments
Closed
Assignees
Labels

Comments

@Demacr
Copy link

Demacr commented Sep 7, 2022

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

# tf version
Terraform v1.2.3
on darwin_amd64
+ provider registry.terraform.io/hashicorp/external v2.2.2
+ provider registry.terraform.io/hashicorp/google v4.25.0
+ provider registry.terraform.io/hashicorp/google-beta v4.25.0
+ provider registry.terraform.io/hashicorp/helm v2.6.0
+ provider registry.terraform.io/hashicorp/kubernetes v2.12.1
+ provider registry.terraform.io/hashicorp/null v3.1.1
+ provider registry.terraform.io/hashicorp/random v3.3.2

Your version of Terraform is out of date! The latest version
is 1.2.8. You can update by downloading from https://www.terraform.io/downloads.html

Affected Resource(s)

google_dns_record_set

Terraform Configuration Files

Before:

resource "google_dns_record_set" "domain" {
  for_each = var.domains

  name = "some.domain.tld"
  type = "A"
  ttl  = 300
  provider = google-beta.dns

  managed_zone = data.google_dns_managed_zone.zone.name

  rrdatas = ["1.2.3.4"]
}

After:

resource "google_dns_record_set" "domain" {
  for_each = var.domains

  name = "some.domain.tld"
  type = "A"
  ttl  = 300
  provider = google-beta.dns

  managed_zone = data.google_dns_managed_zone.zone.name

  routing_policy {
    wrr {
      rrdatas = ["1.2.3.4"]
      weight  = 1000
    }
    wrr {
      rrdatas = [google_compute_global_address.bg.address]
      weight  = 0
    }
  }
}

Debug Output

Panic Output

Expected Behavior

It should update or recreate object without rrdata and with routing_policy block

Actual Behavior

Before applying I had this resource with single rrdata, without routing_policy with IP = 1.2.3.4.

At plan it shows only adding routing_policy block:

  # module.project.google_dns_record_set.domain["domain"] has changed
  ~ resource "google_dns_record_set" "domain" {
        id           = "XXXX/A"
        name         = "domain.some.domain.tld."
        # (5 unchanged attributes hidden)

      + routing_policy {

          + wrr {
              + rrdatas = [
                  + "1.2.3.4",
                ]
              + weight  = 1000
            }
          + wrr {
              + rrdatas = [
                  + "5.6.7.8",
                ]
              + weight  = 0
            }
        }
    }

but doesn't delete rrdata, which causes error at applying:

Error: Error changing DNS RecordSet: googleapi: Error 400: The resource record set 'entity.change.additions[0]' is only permitted to have one record because it is of type 'A'., invalidRecordCount
│
│   with module.project.google_dns_record_set.domain["domain"],
│   on ../modules/project/main.tf line 544, in resource "google_dns_record_set" "domain":
│  544: resource "google_dns_record_set" "domain" {

Steps to Reproduce

  1. terraform apply

Important Factoids

References

  • #0000
@Demacr Demacr added the bug label Sep 7, 2022
@Demacr Demacr changed the title google_dns_record_set don't update resource from single A record to WRR google_dns_record_set don't update resource from single A record to WRR Sep 7, 2022
@edwardmedia edwardmedia self-assigned this Sep 7, 2022
@edwardmedia
Copy link
Contributor

@Demacr you reported this issue happened when you tried to update the resource. Are you able to manually delete the resource and recreate it? The error is from api and it seems the config is blocked by api. Can you share the debug log as well?

googleapi: Error 400: The resource record set 'entity.change.additions[0]' is only permitted to have one record because it is of type 'A'., invalidRecordCount

@Demacr
Copy link
Author

Demacr commented Sep 8, 2022

@edwardmedia thank you for response. Yes, updated it manually by web console. So I think I could did it through recreating. Okay, I'll send debug logs a little bit later.

@edwardmedia
Copy link
Contributor

@Demacr are you able to get the debug log? Or is it still an issue?

@Demacr
Copy link
Author

Demacr commented Sep 28, 2022

@edwardmedia I've checked again and I've seen that appears changing of rrdatas block:

      ~ rrdatas      = [
          - "1.2.3.4",
        ]
        # (4 unchanged attributes hidden)

      + routing_policy {

          + wrr {
              + rrdatas = [
                  + "1.2.3.4",
                ]
              + weight  = 1000
            }
          + wrr {
              + rrdatas = [
                  + "5.6.7.8",
                ]
              + weight  = 0
            }
        }

Seems to be you or someone else fixed this.

@Demacr
Copy link
Author

Demacr commented Sep 28, 2022

Possibly it is fixed in #11872 or #12157, because I updated provider 4.25 -> 4.31

@edwardmedia
Copy link
Contributor

Cool. Thanks for the update @Demacr Closing this then

@github-actions
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 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants