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

Adds support for importing dme_dns_record resource #22

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jimrubenstein
Copy link

Uses the zone name, host name, and record type to perform a search on the DME domain for the record you wish to import

Usage:

terraform import 'dme_dns_record.domain_root' example.com:@:a

terraform import 'dme_dns_record.domain_www' example.com:www:cname

terraform import 'dme_dns_record.domain_mail' example.com:mail:cname

data "dme_domain" "domain" {
  name = "example.com"
}

resource "dme_dns_record" "domain_root" {
  domain_id = dme_domain.domain.id
  name = ""
  value = "127.0.0.1"
  type = "A"
}

resource "dme_dns_record" "domain_www" {
  domain_id = dme_domain.domain.id
  name = "www"
  value = ""
  type = "CNAME"
}

resource "dme_dns_record" "domain_mail" {
  domain_id = dme_domain.domain.id
  name = "mail"
  value = "ghs.googlehosted.com."
  type = "CNAME"
}

@ghost ghost added the size/M label Jul 31, 2020
Uses the zone name, host name, and record type to perform a search on the DME domain for the record you wish to import
@jl-gogovapps
Copy link

jl-gogovapps commented Sep 6, 2020

This PR would be super helpful 🚀

Are there any workarounds to getting resources converted from dme_record to dme_dns_record while waiting for this to be merged? I was hoping to upgrade terraform 0.11 to 0.12

It seems like pointing a provider at a github branch isn't yet supported..

@eperry
Copy link

eperry commented Sep 25, 2020

I gave this PR a test and had a problem with an empty field and value

here is what it looks like in CP
image

Here is my import
terraform import 'dme_dns_record.domain_root' test-domain.com:www:cname

Here is the show

# dme_dns_record.domain_root:
resource "dme_dns_record" "domain_root" {
    domain_id    = "893496"
    dynamic_dns  = "false"
    gtd_location = "DEFAULT"
    hardlink     = "false"
    id           = "10445433"
    name         = "www"
    ttl          = "800"
    type         = "CNAME"
}

I add this to my main.tf file and try to apply it
:~/dev/tf-dnsme$ terraform apply

Error: Missing required argument

  on main.tf line 12, in resource "dme_dns_record" "domain_root":
  12: resource "dme_dns_record" "domain_root" {

The argument "value" is required, but no definition was found.

If I manually add value = "" everything works fine

# dme_dns_record.domain_root:
resource "dme_dns_record" "domain_root" {
    domain_id    = "893496"
    dynamic_dns  = false
    gtd_location = "DEFAULT"
    hardlink     = false
    name         = "www"
    ttl          = "800"
    type         = "CNAME"
    value        = ""
}

And just showing it works here

terraform apply
dme_domain.test-domain: Refreshing state... [id=893496]
dme_dns_record.domain_root: Refreshing state... [id=10445433]
dme_dns_record.test-domain: Refreshing state... [id={}]

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  ~ update in-place
  - destroy

Terraform will perform the following actions:

  # dme_dns_record.domain_root will be updated in-place
  ~ resource "dme_dns_record" "domain_root" {
        domain_id    = "893496"
        dynamic_dns  = "false"
        gtd_location = "DEFAULT"
        hardlink     = "false"
        id           = "10445433"
        name         = "www"
      ~ ttl          = "1800" -> "800"
        type         = "CNAME"
    }

  # dme_dns_record.test-domain will be destroyed
  - resource "dme_dns_record" "test-domain" {
      - domain_id = "893496" -> null
      - id        = jsonencode({}) -> null
    }

Plan: 0 to add, 1 to change, 1 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

dme_dns_record.test-domain: Destroying... [id={}]
dme_dns_record.domain_root: Modifying... [id=10445433]

@johntdyer
Copy link

Any idea whats going on here?? I really could use this support

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants