* Make dnsimple_records importable
terraform 0.7 supports importing a resource into the local state, and
this adds that feature to the dnsimple_record resource.
Unfortunately, the DNSimple v1 API requires a domain name and record ID
to fetch a record, so the import command accepts both pieces of data as
a slash-delimted string like so:
terraform import dnsimple_record.test example.com/1234
* add an acceptance test for importing a dnsimple_record
When a record was manually deleted from the console, we got an error
saying 404 Record Not Found
//cc @weppos
This PR now handles the usecase:
```
% make testacc TEST=./builtin/providers/dnsimple
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/03/28 21:48:19 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/dnsimple -v -timeout 120m
=== RUN TestProvider
--- PASS: TestProvider (0.00s)
=== RUN TestProvider_impl
--- PASS: TestProvider_impl (0.00s)
=== RUN TestAccDNSimpleRecord_Basic
--- PASS: TestAccDNSimpleRecord_Basic (1.81s)
=== RUN TestAccDNSimpleRecord_CreateMxWithPriority
--- PASS: TestAccDNSimpleRecord_CreateMxWithPriority (1.32s)
=== RUN TestAccDNSimpleRecord_Updated
--- PASS: TestAccDNSimpleRecord_Updated (4.46s)
=== RUN TestAccDNSimpleRecord_disappears
--- PASS: TestAccDNSimpleRecord_disappears (1.20s)
=== RUN TestAccDNSimpleRecord_UpdatedMx
--- PASS: TestAccDNSimpleRecord_UpdatedMx (2.91s)
PASS
ok github.com/hashicorp/terraform/builtin/providers/dnsimple 11.723s
```
* Allow priority attribute of dnsimple_record to be set
Some DNS record types (like MX) allow a priority to specified, and the
ability to do so is important in many environments.
This diff will change dnsimple_record.priority from computed to
optional, allowing it to be used in terraform configs like so:
resource "dnsimple_record" "mx1" {
domain = "example.com"
name = ""
value = "mx1.example.com"
type = "MX"
priority = "1"
}
resource "dnsimple_record" "mx2" {
domain = "example.com"
name = ""
value = "mx2.example.com"
type = "MX"
priority = "2"
}
* mention new priority attribute of dnsimple_record
* add acceptance specs for creating/updating MX records at dnsimple
As part of the new changes to the DNSimple provider, we changed to use
the new API version. This requires a token and *not* email address
In order for backwards compatibility - we kept the email address in the
schema but we had the default as nil, meaning that Terraform was
prompting the user for it, they would enter it, then Terraform would
error out due to using a combination of token and email address
This commit makes the default email address an empty String. This means
we don't prompt the user
* Replace DNSimple API client with the official Go client
* Upgrade DNSimple provider to use the new API v2
Acceptance tests pass:
```
=== RUN TestProvider
--- PASS: TestProvider (0.00s)
=== RUN TestProvider_impl
--- PASS: TestProvider_impl (0.00s)
=== RUN TestAccDNSimpleRecord_Basic
--- PASS: TestAccDNSimpleRecord_Basic (2.67s)
=== RUN TestAccDNSimpleRecord_Updated
--- PASS: TestAccDNSimpleRecord_Updated (1.88s)
PASS
ok github.com/hashicorp/terraform/builtin/providers/dnsimple
```
Note that the code still has to be updated to pass the account ID
dynamically in place of "TODO-ACCOUNT".
* Refactor DNSimple provider to expose both client and config
The config is required as the new API wants to know the identifier of
the account you are operating to. The account is not stored in the
client (as the client can talk with different accounts), hence I need
to pass it as part of the config.
* Identify Terraform requests to DNSimple via UserAgent
* Upgrade to the latest dnsimple-go version
* Update docs
Provide upgrade instructions and update the docs for API v2.
* Remove rendundant type declaration