hashicorp / terraform

Terraform enables you to safely and predictably create, change, and improve infrastructure. It is a source-available tool that codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned.
https://www.terraform.io/
Other
42.04k stars 9.47k forks source link

priority is required when domain record type is MX or SRV #2561

Closed tvaughan closed 7 years ago

tvaughan commented 9 years ago

Terraform's DigitialOcean domain_record documentation says that priority is optional. DigitalOcean's API documentation says that priority is required if the domain record type is MX or SRV. When priority is not provided in a terraform plan and it is required by the DigitalOcean API, this is the error:

* Failed to create record: Error creating record: API Error: unprocessable_entity: Priority is not a number and Priority Priority must be an integer between 0 and 65535

Tested on:

$ terraform --version
Terraform v0.5.3
$ lsb_release -a
No LSB modules are available.  
Distributor ID: Ubuntu
Description:    Ubuntu 15.04
Release:        15.04
Codename:       vivid
$ uname -m
x86_64

To reproduce:

resource "digitalocean_domain" "example" {
  ip_address = "127.0.0.1"
  name = "example.com"
}

resource "digitalocean_droplet" "mail" {
  image = "ubuntu-15-04-x64"
  name = "mail.${digitalocean_domain.example.name}"
  region = "nyc1"
  size = "512mb"
  ssh_keys = ["8675309"]
}

resource "digitalocean_record" "mail" {
  domain = "${digitalocean_domain.example.name}"
  name = "mail"
  type = "A"
  value = "${digitalocean_droplet.mail.ipv4_address}"
}

resource "digitalocean_record" "mx" {
  domain = "${digitalocean_domain.example.name}"
  type = "MX"
  value = "${digitalocean_record.mail.name}"
}

I'd like to submit a pull-request to resolve this. Should the DigitalOcean provider require priority, or provide a default value, like 10, when type is MX or SRV? FWIW - I assumed terraform would provide a default.

ghost commented 4 years ago

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.