Giter Club home page Giter Club logo

terraform-provider-dme's Introduction

DNSMadeEasy Provider

Requirements

Building The Provider

Clone this repository to: $GOPATH/src/github.com/DNSMadeEasy/terraform-provider-dme.

$ mkdir -p $GOPATH/src/github.com/DNSMadeEasy; cd $GOPATH/src/github.com/DNSMadeEasy
$ git clone https://github.com/DNSMadeEasy/terraform-provider-dme.git

Enter the provider directory and run make build to build the provider binary.

$ cd $GOPATH/src/github.com/DNSMadeEasy/terraform-provider-dme
$ make build

Using The Provider

If you are building the provider, follow the instructions to install it as a plugin. After placing it into your plugins directory, run terraform init to initialize it.

ex.

#configure provider with your DNSMadeEasy credentials.
provider "dme" {
  # DNSMadeEasy Api key
  apikey = "apikey"
  # DNSMadeEasy secret key
  secretkey = "secretkey"
  insecure = true
  proxy_url = "https://proxy_server:proxy_port"
}

resource "dme_domain" "example" {
  name            = "example.com"
  gtd_enabled     = "false"
  soa_id          = "${dme_custom_soa_record.example.id}"
  template_id     = "${dme_template.example.id}"
  vanity_id       = "${dme_vanity_nameserver_record.example.id}"
  transfer_acl_id = "${dme_transfer_acl.example.id}"
  folder_id       = "${dme_folder.example.id}"
}
terraform plan -parallelism=1
terraform apply -parallelism=1

Developing The Provider

If you want to work on the provider, you'll first need Go installed on your machine. You'll also need to correctly setup a GOPATH, as well as adding $GOPATH/bin to your $PATH.

To compile the provider, run make build. This will build the provider with sanity checks present in scripts directory and put the provider binary in $GOPATH/bin directory.

terraform-provider-dme's People

Contributors

cgriggs01 avatar gechr avatar gonrial avatar grubernaut avatar jefferai avatar jen20 avatar jlund avatar jr-frazier avatar katbyte avatar mitchellh avatar nkatarmal-crest avatar pearkes avatar phinze avatar radeksimko avatar randomcamel avatar rutviks-crest avatar sethvargo avatar stack72 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

terraform-provider-dme's Issues

Is this project still alive?

Hi ๐Ÿ‘‹ I've opened a trial PR to find out will it be considered before making more contributions. However, seems like there is no much traction with the development here.

DNSMadeEasy rate limiting and retries could be better

This issue was originally opened by @knuckolls as hashicorp/terraform#9020. It was migrated here as part of the provider split. The original body of the issue is below.


Terraform repositories with a large amount of dme_record resources overwhelm the dnsmadeeasy api and return with a great deal of 400 errors. Just bubbling this up into an issue. The workaround is to run terraform plan and terraform apply with --parallelism=1 so as to not overwhelm the api.

Cannot loop on resource dme_dns_record

Terraform Version

Terraform v0.13.4

  • provider registry.terraform.io/dnsmadeeasy/dme v0.1.2

Affected Resource(s)

Please list the resources as a list, for example:

  • dme_dns_record

Terraform Configuration Files

terraform {
  required_providers {
    dme = {
      source = "dnsmadeeasy/dme"
      version = "~> 0.1.2"
    }
  }
}

provider "dme" {
  api_key    = "xxx"
  secret_key = "xxx"
}

data "dme_domain" "main" {
  name = "my.domain.com"
}

locals {
  publicIps = ["51.0.0.0", "52.0.0.0"]
}

resource "dme_dns_record" "record" {
  count = length(local.publicIps)

  domain_id = data.dme_domain.main.id
  name      = "dev"
  type      = "A"
  value     = local.publicIps[count.index]
  ttl       = 1800
}

Debug Output

https://gist.github.com/AnthonySendra/de275772f6ddfb5a2af2f2ecf1d3a34e

Expected Behavior

It should create two records for the same domain "dev" pointing to two different IPs: 51.0.0.0 and 52.0.0.0

Actual Behavior

Terraform apply will only save the first one and fail for the second one. If I try to apply a second time, everything works.
If my list of IPs contains only one IP, everything works on the first apply.

Steps to Reproduce

  1. terraform apply

References

Maybe related to #25 (same error)

Expose nameServers on dme_secondary_dns

Right now the resource dme_secondary_dns doesn't return any additional attributes other than what it accepts which reduces it's usefulness. We are using a terraform integration with our registrar to automatically update nameservers and it would be nice if the resource also return the nameServers property that accompanies the dns/secondary API that's specified here:

{
  ...
"nameServers": [
    {
      "ipv6": "2600:1800:5::1",
      "ipv4": "208.94.148.13",
      "fqdn": "ns5.dnsmadeeasy.com",
      "groupId": 100,
      "id": 6
    },
    {
      "ipv6": "2600:1801:6::1",
      "ipv4": "208.80.124.13",
      "fqdn": "ns6.dnsmadeeasy.com",
      "groupId": 100,
      "id": 7
    },
    {
      "ipv6": "2600:1802:7::1",
      "ipv4": "208.80.126.13",
      "fqdn": "ns7.dnsmadeeasy.com",
      "groupId": 100,
      "id": 8
    }
  ]
  ...
}

Right now we have to manually go into the DME dashboard and hard code the variables.

Allow empty names in dme_record (dnsmadeasy)

This issue was originally opened by @benosman as hashicorp/terraform#9034. It was migrated here as part of the provider split. The original body of the issue is below.


I'm having issues setting any kind of record with an empty name field. Name field is required so must be present.

Terraform Version

Terraform v0.7.4

Affected Resource(s)

  • dme_record

Terraform Configuration Files

resource "dme_record" "a_record" {
  domainid = "${var.domainid}"
  name = ""
  type = "A"
  value = "8.8.8.8"
  ttl = "600"
  gtdLocation = "DEFAULT"
}

resource "dme_record" "txt_record" {
  domainid = "${var.domainid}"
  name = ""
  type = "TXT"
  value = "v=spf1 mx a"
  ttl = "600"
  gtdLocation = "DEFAULT"
}

Debug Output

https://gist.github.com/benosman/b4381a3b871c1bee8ec9243fb1fb12c0

Expected Behavior

Records should have been added on the TLD.

Actual Behavior

500 Internal server error.

Steps to Reproduce

  1. terraform apply

References

Similar issues on other DNS providers:

  • GH-8944 - dyn_record
  • GH-7534 - aws_route53_record

records with spaces are modified every run

Terraform Version

Terraform v0.10.7

Affected Resource(s)

Please list the resources as a list, for example:

  • dme_record

Terraform Configuration Files

resource "dme_record" "stitthappens_com_TXT_spf" {
  domainid    = "${var.dme_stitthappens_com}"
  name        = ""
  type        = "TXT"
  value       = "v=spf1 include:_spf.google.com ~all"
  ttl         = 86400
  gtdLocation = "DEFAULT"
}

Debug Output

dme_record.stitthappens_com_TXT_spf: Modifying... (ID: 58119505)
  ttl:   "3600" => "86400"
  value: "\"v=spf1 include:_spf.google.com ~all\"" => "v=spf1 include:_spf.google.com ~all"

Expected Behavior

The name should not update if the only difference is quoting

Actual Behavior

Every run tries to update the record.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply

Important Factoids

I asked support for help with this issue, but they said they only support the web UI.

Import support

Does the DME provider support terraform import? I didn't see this documented here, or DME's support site.

If not, please consider this a feature request for it.

This provider is scheduled to be archived on September 27th, 2018.

This Terraform provider is scheduled to be archived on September 27th, 2018. HashiCorp may archive providers when they have insufficient activity to maintain them at a level consistent with our open source guidelines and community expectations.

What does archiving mean?

  1. The code repository and all commit, issue, and PR history will still be available.
  2. Existing released binaries will remain available on the releases site and available to terraform init.
  3. Documentation for the provider will remain on the Terraform website.
  4. Issues and pull requests are not being monitored, merged, or added.
  5. No new releases will be published.
  6. Nightly acceptance tests may not be run.

If anyone from the community is willing to maintain this provider, please reach out to the Terraform Provider Development Program at [email protected].

Allow empty values in dme_record

Please note this is not exactly the same as issue #3 which is for empty names, not empty values.

Terraform Version

0.11.1

Affected Resource(s)

  • dme_record

Terraform Configuration Files

resource "dme_record" "www" {
  domainid    = "1234"
  name        = "www"
  type        = "CNAME"
  value       = ""
  ttl         = 3600
  gtdLocation = "DEFAULT"
}

Expected Behavior

Terraform should create a "www" CNAME record with an empty value, which is how DNS Made Easy represents the current domain's apex (naked domain).

Actual Behavior

500 error from DNS Made Easy because the "value" parameter is missing.

References

This is closely related to issue #3 and PR #7, except with the value parameter instead of the name parameters.

I made a slight addition to PR #7 at emsearcy/terraform-provider-dme@513fb173 but I haven't made a PR yet because I wanted to add a test, similar to the check for empty names.

Error: API key not found

Hello,

When attempting to test terraform using the sandbox api http[s]://api.sandbox.dnsmadeeasy.com/V2.0/ I am getting Error: API key not found when trying to run terraform apply -parallelism=1

below is my provider configuration

  required_providers {
    dme = {
      source = "DNSMadeEasy/dme"
      version = "0.1.3"
    }
  }
}

provider "dme" {
  api_key = "api-hash"
  secret_key = "secret-hash"
}

dme_record change/modify doesn't seem to be working (add/delete are fine)

This issue was originally opened by @scumola as hashicorp/terraform#17480. It was migrated here as a result of the provider split. The original body of the issue is below.


terraform apply with a modified dme_record entry looks successful, but no changes are actually made. Dupe of old closed issues: hashicorp/terraform#2241 and hashicorp/terraform#3420

Terraform Version

$ terraform -v
Terraform v0.11.3
+ provider.aws v1.9.0
+ provider.dme v0.1.0

Terraform Configuration Files

Debug Output

Crash Output

Expected Behavior

Actual Behavior

Steps to Reproduce

Additional Context

References

Empty name in dme_dns_records

Terraform Version

0.13.3

Affected Resource(s)

  • dme_dns_record

Terraform Configuration Files

resource "dme_dns_record" "record" {
  domain_id = 12345
  name = ""
  type = "HTTPRED"
  ttl = "60"
  value = "https://www.example.com"
  redirect_type = "Standard - 301"
}

Debug Output

2020-09-25T15:39:09.429+0200 [DEBUG] plugin.terraform-provider-dme_v0.1.2: 2020/09/25 15:39:09 Value of recordAttr:  &{  https://www.example.com HTTPRED   60     Standard - 301       }
2020-09-25T15:39:09.429+0200 [DEBUG] plugin.terraform-provider-dme_v0.1.2: 2020/09/25 15:39:09 RECORD VAlues inside model:  &{  https://www.example.com HTTPRED   60     Standard - 301       }
2020-09-25T15:39:09.429+0200 [DEBUG] plugin.terraform-provider-dme_v0.1.2: 2020/09/25 15:39:09 Inside model:after recordmap values:  map[redirectType:Standard - 301 ttl:60 type:HTTPRED value:https://www.example.com]
2020-09-25T15:39:09.429+0200 [DEBUG] plugin.terraform-provider-dme_v0.1.2: 2020/09/25 15:39:09 Payload is : {"redirectType":"Standard - 301","ttl":"60","type":"HTTPRED","value":"https://www.example.com"}
2020-09-25T15:39:09.429+0200 [DEBUG] plugin.terraform-provider-dme_v0.1.2: 2020/09/25 15:39:09 Request made :  &{POST https://api.dnsmadeeasy.com/V2.0/dns/managed/id/records/ HTTP/1.1 1 1 map[Content-Type:[application/json] X-Dnsme-Requestdate:[Fri, 25 Sep 2020 13:39:09 GMT]] {{"redirectType":"Standard - 301","ttl":"60","type":"HTTPRED","value":"https://www.example.com"}} 0x760fc0 97 [] false api.dnsmadeeasy.com map[] map[] <nil> map[]   <nil> <nil> <nil> 0xc000036178}
2020-09-25T15:39:10.322+0200 [DEBUG] plugin.terraform-provider-dme_v0.1.2: 2020/09/25 15:39:10 Response is : &{500 Internal Server Error 500 HTTP/1.1 1 1 map[Content-Type:[text/html;charset=ISO-8859-1] Date:[Fri, 25 Sep 2020 13:38:51 GMT] Server:[Apache-Coyote/1.1] Set-Cookie:[Path=/V2.0; Secure; HttpOnly] 0xc00065a040 -1 [chunked] true false map[] 0xc00010ab00 0xc000469600}
2020-09-25T15:39:10.323+0200 [DEBUG] plugin.terraform-provider-dme_v0.1.2: 2020/09/25 15:39:10 Error returned:  invalid character '<' looking for beginning of value

Expected Behavior

Record added

Actual Behavior

Error: invalid character '<' looking for beginning of value

Steps to Reproduce

  1. terraform apply

References

#3

DNS Made Easy cname records

This issue was originally opened by @phoolish as hashicorp/terraform#12426. It was migrated here as part of the provider split. The original body of the issue is below.


Terraform Version

all

Affected Resource(s)

  • dme_record

Terraform Configuration Files

resource "dme_record" "test" {
  domainid = "${var.dme_domain_id}"
  name = "www"
  type = "CNAME"
  value = "${aws_elb.test.dns_name}."
  ttl = 60
  gtdLocation = "DEFAULT"
}

Expected Behavior

Create dme record with correct DNS value.

Actual Behavior

The record gets created, but it doesn't resolve. Initially, we thought this was due to the lack of a '.' at the end of the value, but adding it didn't solve it. Manually updating the record through the website console resolves the issue.

Making changes to dme_record don't seem to take effect

This issue was originally opened by @philp as hashicorp/terraform#3420. It was migrated here as part of the provider split. The original body of the issue is below.


If I've already applied a me_record resource with terraform apply, and then make changes and run terraform apply again, the changes don't appear to have an effect.

I don't see any error messages. The output appears to indicate that everything has run fine, but I can see that changes haven't taken effect when looking in the DNS Made Easy control panel.

Changing domain ID do not transfer record to new domain ID

Terraform Version

terraform v0.14.2

Affected Resource(s)

dme_dns_record

Terraform Configuration Files

resource "dme_dns_record" "record" {
  domain_id     = "74230"
  name          = "test-record"
  type          = "CNAME"
  ttl           = "3600"
  value         = "www.example.org."
}

Debug Output

from terraform plan:

  ~ resource "dme_dns_record" "record" {
      ~ domain_id       = "7321" -> "74230"
        id              = (sensitive)
        name            = "test-record"
      ~ value           = (sensitive)
        # (16 unchanged attributes hidden)
    }

Expected Behavior

What should have happened?
It should delete record from previous domain and create it in new domain

Actual Behavior

What actually happened?
It update value, but kept record in old domain.

Steps to Reproduce

  1. create a record in domain A via dme_dns_record
  2. change dme_dns_record domain_id to domain B
  3. you can see record did not come to domain B and it is still in domain A

My Temporarily work-around

Comment dme_dns_record blocks so that it delete them in DNS Made Easy panel.
Uncomment so that it recreate them again in correct domain ID.

dynamic DNS record IPs overwritten by terraform provider

Terraform Version

Terraform v1.1.7
on linux_amd64
+ provider registry.terraform.io/carlpett/sops v0.6.3
+ provider registry.terraform.io/dnsmadeeasy/dme v1.0.4
+ provider registry.terraform.io/goauthentik/authentik v2022.3.2
+ provider registry.terraform.io/paultyng/unifi v0.34.0
+ provider registry.terraform.io/telkomindonesia/linux v0.7.0

Affected Resource(s)

  • dme_dns_record

Terraform Configuration Files

resource "dme_dns_record" "dyn_record" {
  domain_id     = "domain ID"
  name          = "foo-dyndns"
  type          = "A"
  value         = "1.2.3.4"
  ttl           = 600
  dynamic_dns   = true
  password      = "aPassword"

Debug Output

NA

Panic Output

NA

Expected Behavior

value is currently a required parameter. I would expect it to be optional in case of dynamic_dns=true to avoid overriding the dynamic IP on the next terraform apply.

I would expect the following input to be accepted by making value optional:

resource "dme_dns_record" "dyn_record" {
  domain_id     = "domain ID"
  name          = "foo-dyndns"
  type          = "A"
  ttl           = 600
  dynamic_dns   = true
  password      = "aPassword"

Alternative would be to ignore the value when the record already exists.

Actual Behavior

On each terraform apply the IP address uploaded by my router is overriden by hardcoded value in terraform. With this we loose the dynamic capabilities.

Steps to Reproduce

  1. terraform apply
  2. modify the IP address either by the UI or with a dyndns client
  3. terraform apply -> IP change from step 2 is lost.

Important Factoids

NA

References

NA

Rate limit exceeded - self-adjusting rate or sleep between api calls?

Terraform Version

0.14.7

Affected Resource(s)

dme_dns_record

Debug Output

Error: Rate limit exceeded

Expected Behavior

Dns entries added

Actual Behavior

Rate limit exceeded and state refreshing failed

Steps to Reproduce

Add like 60 dns entries, try to refresh 3 times and the DME api will respond with rate limit exceeded

Important Factoids

Would be nice if we could specify either a max rate limit for the module or a sleep between calls to DME so we don't cross the default rate limit.

Add support for Apple's M1 platform

I'm seeing the following error on an M1 MacBook Air, when I try to run terraform init for my project:

โ”‚ Error: Incompatible provider version
โ”‚
โ”‚ Provider registry.terraform.io/dnsmadeeasy/dme v1.0.4 does not have a package available for your current platform, darwin_arm64.
โ”‚
โ”‚ Provider releases are separate from Terraform CLI releases, so not all providers are available for all platforms. Other versions of this
โ”‚ provider may have different platforms supported.

There's some related discussion about the issue here: hashicorp/terraform#27257

`dme_dns_record` not updating CNAME record for already-existent record on domain

Terraform Version

Terraform v0.12.29

  • provider.aws v2.70.0
  • provider.dme v0.1.1

Affected Resource(s)

  • dme_dns_record

Terraform Configuration Files

provider "dme" {
	api_key = "apiKey"
	secret_key = "apiSecret"
	insecure = false
}

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

resource "dme_dns_record" "web" {
	domain_id = data.dme_domain.domain_com.id
	name = "test"
	type = "CNAME"
	value = "www.google.com."
	ttl = 300
}

Debug Output

Relevant part of the debug log pasted here:

https://gist.github.com/jimrubenstein/9e326175b1093c1bb38ced0f526ace79

Panic Output

N/A

Expected Behavior

I would expect one of two things to happen

  1. Provider recognizes CNAME record exists already, and uses API to update it in-place using a PUT request on the api
  2. Provider recognizes CNAME record exists already, and issues a Destroy and subsequent Create.

If intended behavior is to not overwrite records, by default, an additional input on the dme_dns_record signaling a forced overwrite is okay, would be useful to facilitate the above behavior.

Actual Behavior

Provider attempts to POST request to API (which is the CREATE) action on the API and is treated differently than an UPDATE (PUT HTTP verb), which is what causes the error.

Steps to Reproduce

  1. Create conflicting CNAME record on a DOMAIN in your DNS Made Easy panel (test.example.com)
  2. Modify config to reflect correct API key and secret, update dme_domain domain name
  3. terraform apply

Important Factoids

This is a pared down, contrived, version of my terraform definition. Have confirmed this behavior with the, exact, above-pasted configuration (with my own domain name, obviously).

Also, I realize terraform doesn't touch things it doesn't know about. But, given the ethos that terraform isn't an all-or-nothing endeavor and we're trying to iteratively adopt it into our infrastructure, I need a way to either overwrite an existing CNAME record, or a feasible way to IMPORT a record into my tfstate.

References

N/A

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.