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

Add import support to google_dns_record_set #895

Merged
merged 6 commits into from
Jan 17, 2018

Conversation

rosbo
Copy link
Contributor

@rosbo rosbo commented Dec 22, 2017

Fixes #743

@rosbo rosbo force-pushed the import-dns-record-set branch from 5a9d544 to af2fb22 Compare December 22, 2017 21:19
@ean
Copy link

ean commented Jan 15, 2018

I tried out this PR, and it works great.
One small issue with an error message that is a bit confusing. The ID provided says it expects a different format than is really does.

$ terraform import google_dns_record_set.root-txt data
google_dns_record_set.root-txt: Importing from ID "data"...

Error: google_dns_record_set.root-txt (import id: data): import google_dns_record_set.root-txt (id: data): Invalid dns record specifier. Expecting {project}/{zone name}/{record name}/{record type}

$ terraform import google_dns_record_set.root-txt foo/zone-name/example.com./TXT
google_dns_record_set.root-txt: Importing from ID "foo/zone-name/example.com./TXT"...

Error: google_dns_record_set.root-txt (import id: foo/zone-name/example.com./TXT): import google_dns_record_set.root-txt (id: foo/zone-name/example.com./TXT): Invalid dns record specifier. Expecting {project}/{zone name}/{record name}/{record type}

From the source code https://github.com/terraform-providers/terraform-provider-google/pull/895/files#diff-8bfe0d9a51bbbdf68e796b35fac038ffR297 the expected format is zone/name/type

@rosbo
Copy link
Contributor Author

rosbo commented Jan 17, 2018

I fixed the error message and improved the docs slightly.

Copy link
Contributor

@nat-henderson nat-henderson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it works, just one question.

func resourceDnsRecordSetImportState(d *schema.ResourceData, _ interface{}) ([]*schema.ResourceData, error) {
parts := strings.Split(d.Id(), "/")
if len(parts) != 3 {
return nil, fmt.Errorf("Invalid dns record specifier. Expecting {zone-name}/{record-name}/{record-type}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think most people aren't going to know to add an extra . after the record name - might be a good place to tell them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. I also updated the docs to add a note about this.

@rosbo rosbo merged commit fc7c0ce into hashicorp:master Jan 17, 2018
@rosbo rosbo deleted the import-dns-record-set branch January 17, 2018 19:19
chrisst pushed a commit to chrisst/terraform-provider-google that referenced this pull request Nov 9, 2018
* Add import support to google_dns_record_set

* Add import test to NS record

* Minimize diff change

* Improve docs

* Make error message more helpful

* Add note about trailing dot at the end of the record name
modular-magician added a commit to modular-magician/terraform-provider-google that referenced this pull request Sep 27, 2019
@ghost
Copy link

ghost commented Mar 30, 2020

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!

@ghost ghost locked and limited conversation to collaborators Mar 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add import cmd for google_dns_record_set
3 participants