-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
terraform import doesn't work with cloud DNS in GCP #3280
terraform import doesn't work with cloud DNS in GCP #3280
Comments
Can you please send us your config for your dns_record_set and the debug log when you import? i.e.
I was able to correctly import a DNS record set just now so I probably need more information to debug this issue. |
@emilymye is there any private channel you want us to share all config and debug details? |
I have attached the dns record import debug log here. DNS record config details: |
@emilymye @rileykarson any updates on this bug? |
Can you confirm whether you experience this on a |
yes i upgraded to 2.3.0 release, and i am still getting same error in terraform import. Error: module.cloud_dns.google_dns_record_set.a[0] (import id: prod-us-central1-aaaa-io/aaa01.prod.us-central1.aaaa.io/A): 1 error(s) occurred:
|
Are you able to share the command you're using + debug logs at that version? |
I have attached debug log with command here. |
Comparing the debug logs to our CI, I think Terraform is performing correctly, it's just an issue with the format of the supplied id. Unfortunately this resource is pretty freeform, and I can't spot any obvious fixes. Has this worked in prior versions? |
No this has never worked for us before, We filed one more bug for similar errors in google instance group import back in December last year. |
In that case I suspect an incorrect id has been supplied. Can you try https://cloud.google.com/sdk/gcloud/reference/dns/record-sets/ |
Here is the output for describe and list commands. |
any updates on this bug based on last input provided. |
Hmm- I'm fairly confident that the managed zone name is incorrect. Can you try |
There are so many zones coming in the output. I am pasting the one that i am trying to import from { |
Hmm- unfortunately, I can't see what's going wrong here. Since |
gcloud can find the managed zone in above output |
can we discuss over hangout or share details on a private channel to investigate this issue. |
|
The above error we are getting in terraform import and that is the reason we are not able to import dns records or instance groups (#2504) from gcp, but i dont get when you say we are unable to see a managed zone using gcloud. I am attaching a complete output for |
The problem is that neither
Looking at the import example (https://www.terraform.io/docs/providers/google/r/dns_record_set.html#import) you need a trailing dot, eg;
|
yes earlier we imported without trailing dot. Now when we added trailing dot, its still throwing same error. I am attaching the error log here.
|
In that case, since we're seeing similar behaviour between I would include the |
@Preete is the DNS record you're trying to import in the same project as the one specified in your That is how I have encountered this issue, it appears there is no way to specify the project to import the record from. Our workaround has been to temporarily change the project in the provider block, import the resource, then change it back. |
I'm experiencing exactly the same problem as @rsalmond. There's no way to specify the project when importing a @rsalmond's workaround works for me. |
Same here:
Any clues? |
I was able to work around the issue thanks to @rsalmond comment. If your DNS zone is managed in another GCP project than your application, make sure to switch the Google provider(s) to use your DNS project instead of your application project when you import the DNS. Even with an aliased provider it didn't work, it looks like the import used the first "google" provider in my providers list. |
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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks! |
I am trying to import cloud dns A record from GCP using terraform import but it throws error. The record already exists so the error for non-existent resource doesn't make sense below. Did anyone try it before?
module.cloud_dns.google_dns_record_set.a: Importing from ID "production-us-east1/server1/A"...
module.cloud_dns.google_dns_record_set.a: Import complete!
Imported google_dns_record_set (ID: production-us-east1/server1/A)
module.cloud_dns.google_dns_record_set.a: Refreshing state... (ID: production-us-east1/server1/A)
Error: module.cloud_dns.google_dns_record_set.a[0] (import id: production-us-east1/server1/A): 1 error(s) occurred:
import module.cloud_dns.google_dns_record_set.a[0] result: production-us-east1/server1/A: import module.cloud_dns.google_dns_record_set.a (id: production-us-east1/server1/A): Terraform detected a resource with this ID doesn't
exist. Please verify the ID is correct. You cannot import non-existent
resources using Terraform import.
Community Note
Terraform Version
terraform version
Terraform v0.11.10
Affected Resource(s)
Terraform Configuration Files
Debug Output
Panic Output
Expected Behavior
google dns a record imported.
Actual Behavior
module.cloud_dns.google_dns_record_set.a: Importing from ID "production-us-east1/server1/A"...
module.cloud_dns.google_dns_record_set.a: Import complete!
Imported google_dns_record_set (ID: production-us-east1/server1/A)
module.cloud_dns.google_dns_record_set.a: Refreshing state... (ID: production-us-east1/server1/A)
Error: module.cloud_dns.google_dns_record_set.a[0] (import id: production-us-east1/server1/A): 1 error(s) occurred:
import module.cloud_dns.google_dns_record_set.a[0] result: production-us-east1/server1/A: import module.cloud_dns.google_dns_record_set.a (id: production-us-east1/server1/A): Terraform detected a resource with this ID doesn't
exist. Please verify the ID is correct. You cannot import non-existent
resources using Terraform import.
Steps to Reproduce
following terraform doc online https://www.terraform.io/docs/providers/google/r/dns_record_set.html
terraform import google_dns_record_set.frontend prod-zone/frontend.prod.mydomain.com./A
Important Factoids
References
The text was updated successfully, but these errors were encountered: