terraform/builtin/providers/triton/provider.go

181 lines
4.6 KiB
Go
Raw Normal View History

package triton
import (
provider/triton: Move to joyent/triton-go (#13225) * provider/triton: Move to joyent/triton-go This commit moves the Triton provider to the new joyent/triton-go library from gosdc. This has a number of advantages - not least that requests can be signed using an SSH agent without having to keep unencrypted key material in memory. Schema has been maintained for all resources, and several tests have been added and acceptance tests repaired - in some cases by fixing bugs in the underlying resources. After applying this patch, all acceptance tests pass: ``` go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/30 13:48:33 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/triton -v -timeout 120m === RUN TestProvider --- PASS: TestProvider (0.00s) === RUN TestProvider_impl --- PASS: TestProvider_impl (0.00s) === RUN TestAccTritonFabric_basic --- PASS: TestAccTritonFabric_basic (15.11s) === RUN TestAccTritonFirewallRule_basic --- PASS: TestAccTritonFirewallRule_basic (1.48s) === RUN TestAccTritonFirewallRule_update --- PASS: TestAccTritonFirewallRule_update (1.55s) === RUN TestAccTritonFirewallRule_enable --- PASS: TestAccTritonFirewallRule_enable (1.52s) === RUN TestAccTritonKey_basic --- PASS: TestAccTritonKey_basic (11.76s) === RUN TestAccTritonKey_noKeyName --- PASS: TestAccTritonKey_noKeyName (11.20s) === RUN TestAccTritonMachine_basic --- PASS: TestAccTritonMachine_basic (82.19s) === RUN TestAccTritonMachine_dns --- PASS: TestAccTritonMachine_dns (173.36s) === RUN TestAccTritonMachine_nic --- PASS: TestAccTritonMachine_nic (167.82s) === RUN TestAccTritonMachine_addNIC --- PASS: TestAccTritonMachine_addNIC (192.11s) === RUN TestAccTritonMachine_firewall --- PASS: TestAccTritonMachine_firewall (188.53s) === RUN TestAccTritonMachine_metadata --- PASS: TestAccTritonMachine_metadata (614.57s) === RUN TestAccTritonVLAN_basic --- PASS: TestAccTritonVLAN_basic (0.93s) === RUN TestAccTritonVLAN_update --- PASS: TestAccTritonVLAN_update (1.50s) PASS ok github.com/hashicorp/terraform/builtin/providers/triton 1463.621s ``` * provider/triton: Update docs for provider config * deps: Vendor github.com/joyent/triton-go/... * deps: Remove github.com/joyent/gosdc
2017-03-31 00:25:27 +02:00
"crypto/md5"
"encoding/base64"
"errors"
"sort"
"time"
provider/triton: Move to joyent/triton-go (#13225) * provider/triton: Move to joyent/triton-go This commit moves the Triton provider to the new joyent/triton-go library from gosdc. This has a number of advantages - not least that requests can be signed using an SSH agent without having to keep unencrypted key material in memory. Schema has been maintained for all resources, and several tests have been added and acceptance tests repaired - in some cases by fixing bugs in the underlying resources. After applying this patch, all acceptance tests pass: ``` go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/30 13:48:33 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/triton -v -timeout 120m === RUN TestProvider --- PASS: TestProvider (0.00s) === RUN TestProvider_impl --- PASS: TestProvider_impl (0.00s) === RUN TestAccTritonFabric_basic --- PASS: TestAccTritonFabric_basic (15.11s) === RUN TestAccTritonFirewallRule_basic --- PASS: TestAccTritonFirewallRule_basic (1.48s) === RUN TestAccTritonFirewallRule_update --- PASS: TestAccTritonFirewallRule_update (1.55s) === RUN TestAccTritonFirewallRule_enable --- PASS: TestAccTritonFirewallRule_enable (1.52s) === RUN TestAccTritonKey_basic --- PASS: TestAccTritonKey_basic (11.76s) === RUN TestAccTritonKey_noKeyName --- PASS: TestAccTritonKey_noKeyName (11.20s) === RUN TestAccTritonMachine_basic --- PASS: TestAccTritonMachine_basic (82.19s) === RUN TestAccTritonMachine_dns --- PASS: TestAccTritonMachine_dns (173.36s) === RUN TestAccTritonMachine_nic --- PASS: TestAccTritonMachine_nic (167.82s) === RUN TestAccTritonMachine_addNIC --- PASS: TestAccTritonMachine_addNIC (192.11s) === RUN TestAccTritonMachine_firewall --- PASS: TestAccTritonMachine_firewall (188.53s) === RUN TestAccTritonMachine_metadata --- PASS: TestAccTritonMachine_metadata (614.57s) === RUN TestAccTritonVLAN_basic --- PASS: TestAccTritonVLAN_basic (0.93s) === RUN TestAccTritonVLAN_update --- PASS: TestAccTritonVLAN_update (1.50s) PASS ok github.com/hashicorp/terraform/builtin/providers/triton 1463.621s ``` * provider/triton: Update docs for provider config * deps: Vendor github.com/joyent/triton-go/... * deps: Remove github.com/joyent/gosdc
2017-03-31 00:25:27 +02:00
"github.com/hashicorp/errwrap"
"github.com/hashicorp/go-multierror"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/terraform"
provider/triton: Move to joyent/triton-go (#13225) * provider/triton: Move to joyent/triton-go This commit moves the Triton provider to the new joyent/triton-go library from gosdc. This has a number of advantages - not least that requests can be signed using an SSH agent without having to keep unencrypted key material in memory. Schema has been maintained for all resources, and several tests have been added and acceptance tests repaired - in some cases by fixing bugs in the underlying resources. After applying this patch, all acceptance tests pass: ``` go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/30 13:48:33 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/triton -v -timeout 120m === RUN TestProvider --- PASS: TestProvider (0.00s) === RUN TestProvider_impl --- PASS: TestProvider_impl (0.00s) === RUN TestAccTritonFabric_basic --- PASS: TestAccTritonFabric_basic (15.11s) === RUN TestAccTritonFirewallRule_basic --- PASS: TestAccTritonFirewallRule_basic (1.48s) === RUN TestAccTritonFirewallRule_update --- PASS: TestAccTritonFirewallRule_update (1.55s) === RUN TestAccTritonFirewallRule_enable --- PASS: TestAccTritonFirewallRule_enable (1.52s) === RUN TestAccTritonKey_basic --- PASS: TestAccTritonKey_basic (11.76s) === RUN TestAccTritonKey_noKeyName --- PASS: TestAccTritonKey_noKeyName (11.20s) === RUN TestAccTritonMachine_basic --- PASS: TestAccTritonMachine_basic (82.19s) === RUN TestAccTritonMachine_dns --- PASS: TestAccTritonMachine_dns (173.36s) === RUN TestAccTritonMachine_nic --- PASS: TestAccTritonMachine_nic (167.82s) === RUN TestAccTritonMachine_addNIC --- PASS: TestAccTritonMachine_addNIC (192.11s) === RUN TestAccTritonMachine_firewall --- PASS: TestAccTritonMachine_firewall (188.53s) === RUN TestAccTritonMachine_metadata --- PASS: TestAccTritonMachine_metadata (614.57s) === RUN TestAccTritonVLAN_basic --- PASS: TestAccTritonVLAN_basic (0.93s) === RUN TestAccTritonVLAN_update --- PASS: TestAccTritonVLAN_update (1.50s) PASS ok github.com/hashicorp/terraform/builtin/providers/triton 1463.621s ``` * provider/triton: Update docs for provider config * deps: Vendor github.com/joyent/triton-go/... * deps: Remove github.com/joyent/gosdc
2017-03-31 00:25:27 +02:00
"github.com/joyent/triton-go"
"github.com/joyent/triton-go/authentication"
)
// Provider returns a terraform.ResourceProvider.
func Provider() terraform.ResourceProvider {
return &schema.Provider{
Schema: map[string]*schema.Schema{
provider/triton: Move to joyent/triton-go (#13225) * provider/triton: Move to joyent/triton-go This commit moves the Triton provider to the new joyent/triton-go library from gosdc. This has a number of advantages - not least that requests can be signed using an SSH agent without having to keep unencrypted key material in memory. Schema has been maintained for all resources, and several tests have been added and acceptance tests repaired - in some cases by fixing bugs in the underlying resources. After applying this patch, all acceptance tests pass: ``` go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/30 13:48:33 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/triton -v -timeout 120m === RUN TestProvider --- PASS: TestProvider (0.00s) === RUN TestProvider_impl --- PASS: TestProvider_impl (0.00s) === RUN TestAccTritonFabric_basic --- PASS: TestAccTritonFabric_basic (15.11s) === RUN TestAccTritonFirewallRule_basic --- PASS: TestAccTritonFirewallRule_basic (1.48s) === RUN TestAccTritonFirewallRule_update --- PASS: TestAccTritonFirewallRule_update (1.55s) === RUN TestAccTritonFirewallRule_enable --- PASS: TestAccTritonFirewallRule_enable (1.52s) === RUN TestAccTritonKey_basic --- PASS: TestAccTritonKey_basic (11.76s) === RUN TestAccTritonKey_noKeyName --- PASS: TestAccTritonKey_noKeyName (11.20s) === RUN TestAccTritonMachine_basic --- PASS: TestAccTritonMachine_basic (82.19s) === RUN TestAccTritonMachine_dns --- PASS: TestAccTritonMachine_dns (173.36s) === RUN TestAccTritonMachine_nic --- PASS: TestAccTritonMachine_nic (167.82s) === RUN TestAccTritonMachine_addNIC --- PASS: TestAccTritonMachine_addNIC (192.11s) === RUN TestAccTritonMachine_firewall --- PASS: TestAccTritonMachine_firewall (188.53s) === RUN TestAccTritonMachine_metadata --- PASS: TestAccTritonMachine_metadata (614.57s) === RUN TestAccTritonVLAN_basic --- PASS: TestAccTritonVLAN_basic (0.93s) === RUN TestAccTritonVLAN_update --- PASS: TestAccTritonVLAN_update (1.50s) PASS ok github.com/hashicorp/terraform/builtin/providers/triton 1463.621s ``` * provider/triton: Update docs for provider config * deps: Vendor github.com/joyent/triton-go/... * deps: Remove github.com/joyent/gosdc
2017-03-31 00:25:27 +02:00
"account": {
Type: schema.TypeString,
Required: true,
DefaultFunc: schema.MultiEnvDefaultFunc([]string{"TRITON_ACCOUNT", "SDC_ACCOUNT"}, ""),
},
provider/triton: Move to joyent/triton-go (#13225) * provider/triton: Move to joyent/triton-go This commit moves the Triton provider to the new joyent/triton-go library from gosdc. This has a number of advantages - not least that requests can be signed using an SSH agent without having to keep unencrypted key material in memory. Schema has been maintained for all resources, and several tests have been added and acceptance tests repaired - in some cases by fixing bugs in the underlying resources. After applying this patch, all acceptance tests pass: ``` go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/30 13:48:33 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/triton -v -timeout 120m === RUN TestProvider --- PASS: TestProvider (0.00s) === RUN TestProvider_impl --- PASS: TestProvider_impl (0.00s) === RUN TestAccTritonFabric_basic --- PASS: TestAccTritonFabric_basic (15.11s) === RUN TestAccTritonFirewallRule_basic --- PASS: TestAccTritonFirewallRule_basic (1.48s) === RUN TestAccTritonFirewallRule_update --- PASS: TestAccTritonFirewallRule_update (1.55s) === RUN TestAccTritonFirewallRule_enable --- PASS: TestAccTritonFirewallRule_enable (1.52s) === RUN TestAccTritonKey_basic --- PASS: TestAccTritonKey_basic (11.76s) === RUN TestAccTritonKey_noKeyName --- PASS: TestAccTritonKey_noKeyName (11.20s) === RUN TestAccTritonMachine_basic --- PASS: TestAccTritonMachine_basic (82.19s) === RUN TestAccTritonMachine_dns --- PASS: TestAccTritonMachine_dns (173.36s) === RUN TestAccTritonMachine_nic --- PASS: TestAccTritonMachine_nic (167.82s) === RUN TestAccTritonMachine_addNIC --- PASS: TestAccTritonMachine_addNIC (192.11s) === RUN TestAccTritonMachine_firewall --- PASS: TestAccTritonMachine_firewall (188.53s) === RUN TestAccTritonMachine_metadata --- PASS: TestAccTritonMachine_metadata (614.57s) === RUN TestAccTritonVLAN_basic --- PASS: TestAccTritonVLAN_basic (0.93s) === RUN TestAccTritonVLAN_update --- PASS: TestAccTritonVLAN_update (1.50s) PASS ok github.com/hashicorp/terraform/builtin/providers/triton 1463.621s ``` * provider/triton: Update docs for provider config * deps: Vendor github.com/joyent/triton-go/... * deps: Remove github.com/joyent/gosdc
2017-03-31 00:25:27 +02:00
"url": {
Type: schema.TypeString,
Required: true,
DefaultFunc: schema.MultiEnvDefaultFunc([]string{"TRITON_URL", "SDC_URL"}, "https://us-west-1.api.joyentcloud.com"),
},
provider/triton: Move to joyent/triton-go (#13225) * provider/triton: Move to joyent/triton-go This commit moves the Triton provider to the new joyent/triton-go library from gosdc. This has a number of advantages - not least that requests can be signed using an SSH agent without having to keep unencrypted key material in memory. Schema has been maintained for all resources, and several tests have been added and acceptance tests repaired - in some cases by fixing bugs in the underlying resources. After applying this patch, all acceptance tests pass: ``` go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/30 13:48:33 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/triton -v -timeout 120m === RUN TestProvider --- PASS: TestProvider (0.00s) === RUN TestProvider_impl --- PASS: TestProvider_impl (0.00s) === RUN TestAccTritonFabric_basic --- PASS: TestAccTritonFabric_basic (15.11s) === RUN TestAccTritonFirewallRule_basic --- PASS: TestAccTritonFirewallRule_basic (1.48s) === RUN TestAccTritonFirewallRule_update --- PASS: TestAccTritonFirewallRule_update (1.55s) === RUN TestAccTritonFirewallRule_enable --- PASS: TestAccTritonFirewallRule_enable (1.52s) === RUN TestAccTritonKey_basic --- PASS: TestAccTritonKey_basic (11.76s) === RUN TestAccTritonKey_noKeyName --- PASS: TestAccTritonKey_noKeyName (11.20s) === RUN TestAccTritonMachine_basic --- PASS: TestAccTritonMachine_basic (82.19s) === RUN TestAccTritonMachine_dns --- PASS: TestAccTritonMachine_dns (173.36s) === RUN TestAccTritonMachine_nic --- PASS: TestAccTritonMachine_nic (167.82s) === RUN TestAccTritonMachine_addNIC --- PASS: TestAccTritonMachine_addNIC (192.11s) === RUN TestAccTritonMachine_firewall --- PASS: TestAccTritonMachine_firewall (188.53s) === RUN TestAccTritonMachine_metadata --- PASS: TestAccTritonMachine_metadata (614.57s) === RUN TestAccTritonVLAN_basic --- PASS: TestAccTritonVLAN_basic (0.93s) === RUN TestAccTritonVLAN_update --- PASS: TestAccTritonVLAN_update (1.50s) PASS ok github.com/hashicorp/terraform/builtin/providers/triton 1463.621s ``` * provider/triton: Update docs for provider config * deps: Vendor github.com/joyent/triton-go/... * deps: Remove github.com/joyent/gosdc
2017-03-31 00:25:27 +02:00
"key_material": {
Type: schema.TypeString,
provider/triton: Move to joyent/triton-go (#13225) * provider/triton: Move to joyent/triton-go This commit moves the Triton provider to the new joyent/triton-go library from gosdc. This has a number of advantages - not least that requests can be signed using an SSH agent without having to keep unencrypted key material in memory. Schema has been maintained for all resources, and several tests have been added and acceptance tests repaired - in some cases by fixing bugs in the underlying resources. After applying this patch, all acceptance tests pass: ``` go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/30 13:48:33 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/triton -v -timeout 120m === RUN TestProvider --- PASS: TestProvider (0.00s) === RUN TestProvider_impl --- PASS: TestProvider_impl (0.00s) === RUN TestAccTritonFabric_basic --- PASS: TestAccTritonFabric_basic (15.11s) === RUN TestAccTritonFirewallRule_basic --- PASS: TestAccTritonFirewallRule_basic (1.48s) === RUN TestAccTritonFirewallRule_update --- PASS: TestAccTritonFirewallRule_update (1.55s) === RUN TestAccTritonFirewallRule_enable --- PASS: TestAccTritonFirewallRule_enable (1.52s) === RUN TestAccTritonKey_basic --- PASS: TestAccTritonKey_basic (11.76s) === RUN TestAccTritonKey_noKeyName --- PASS: TestAccTritonKey_noKeyName (11.20s) === RUN TestAccTritonMachine_basic --- PASS: TestAccTritonMachine_basic (82.19s) === RUN TestAccTritonMachine_dns --- PASS: TestAccTritonMachine_dns (173.36s) === RUN TestAccTritonMachine_nic --- PASS: TestAccTritonMachine_nic (167.82s) === RUN TestAccTritonMachine_addNIC --- PASS: TestAccTritonMachine_addNIC (192.11s) === RUN TestAccTritonMachine_firewall --- PASS: TestAccTritonMachine_firewall (188.53s) === RUN TestAccTritonMachine_metadata --- PASS: TestAccTritonMachine_metadata (614.57s) === RUN TestAccTritonVLAN_basic --- PASS: TestAccTritonVLAN_basic (0.93s) === RUN TestAccTritonVLAN_update --- PASS: TestAccTritonVLAN_update (1.50s) PASS ok github.com/hashicorp/terraform/builtin/providers/triton 1463.621s ``` * provider/triton: Update docs for provider config * deps: Vendor github.com/joyent/triton-go/... * deps: Remove github.com/joyent/gosdc
2017-03-31 00:25:27 +02:00
Optional: true,
DefaultFunc: schema.MultiEnvDefaultFunc([]string{"TRITON_KEY_MATERIAL", "SDC_KEY_MATERIAL"}, ""),
},
provider/triton: Move to joyent/triton-go (#13225) * provider/triton: Move to joyent/triton-go This commit moves the Triton provider to the new joyent/triton-go library from gosdc. This has a number of advantages - not least that requests can be signed using an SSH agent without having to keep unencrypted key material in memory. Schema has been maintained for all resources, and several tests have been added and acceptance tests repaired - in some cases by fixing bugs in the underlying resources. After applying this patch, all acceptance tests pass: ``` go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/30 13:48:33 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/triton -v -timeout 120m === RUN TestProvider --- PASS: TestProvider (0.00s) === RUN TestProvider_impl --- PASS: TestProvider_impl (0.00s) === RUN TestAccTritonFabric_basic --- PASS: TestAccTritonFabric_basic (15.11s) === RUN TestAccTritonFirewallRule_basic --- PASS: TestAccTritonFirewallRule_basic (1.48s) === RUN TestAccTritonFirewallRule_update --- PASS: TestAccTritonFirewallRule_update (1.55s) === RUN TestAccTritonFirewallRule_enable --- PASS: TestAccTritonFirewallRule_enable (1.52s) === RUN TestAccTritonKey_basic --- PASS: TestAccTritonKey_basic (11.76s) === RUN TestAccTritonKey_noKeyName --- PASS: TestAccTritonKey_noKeyName (11.20s) === RUN TestAccTritonMachine_basic --- PASS: TestAccTritonMachine_basic (82.19s) === RUN TestAccTritonMachine_dns --- PASS: TestAccTritonMachine_dns (173.36s) === RUN TestAccTritonMachine_nic --- PASS: TestAccTritonMachine_nic (167.82s) === RUN TestAccTritonMachine_addNIC --- PASS: TestAccTritonMachine_addNIC (192.11s) === RUN TestAccTritonMachine_firewall --- PASS: TestAccTritonMachine_firewall (188.53s) === RUN TestAccTritonMachine_metadata --- PASS: TestAccTritonMachine_metadata (614.57s) === RUN TestAccTritonVLAN_basic --- PASS: TestAccTritonVLAN_basic (0.93s) === RUN TestAccTritonVLAN_update --- PASS: TestAccTritonVLAN_update (1.50s) PASS ok github.com/hashicorp/terraform/builtin/providers/triton 1463.621s ``` * provider/triton: Update docs for provider config * deps: Vendor github.com/joyent/triton-go/... * deps: Remove github.com/joyent/gosdc
2017-03-31 00:25:27 +02:00
"key_id": {
Type: schema.TypeString,
Required: true,
DefaultFunc: schema.MultiEnvDefaultFunc([]string{"TRITON_KEY_ID", "SDC_KEY_ID"}, ""),
},
"insecure_skip_tls_verify": {
Type: schema.TypeBool,
Optional: true,
DefaultFunc: schema.EnvDefaultFunc("TRITON_SKIP_TLS_VERIFY", ""),
},
},
ResourcesMap: map[string]*schema.Resource{
"triton_firewall_rule": resourceFirewallRule(),
"triton_machine": resourceMachine(),
"triton_key": resourceKey(),
2016-03-29 23:38:34 +02:00
"triton_vlan": resourceVLAN(),
2016-03-30 00:13:03 +02:00
"triton_fabric": resourceFabric(),
},
ConfigureFunc: providerConfigure,
}
}
provider/triton: Move to joyent/triton-go (#13225) * provider/triton: Move to joyent/triton-go This commit moves the Triton provider to the new joyent/triton-go library from gosdc. This has a number of advantages - not least that requests can be signed using an SSH agent without having to keep unencrypted key material in memory. Schema has been maintained for all resources, and several tests have been added and acceptance tests repaired - in some cases by fixing bugs in the underlying resources. After applying this patch, all acceptance tests pass: ``` go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/30 13:48:33 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/triton -v -timeout 120m === RUN TestProvider --- PASS: TestProvider (0.00s) === RUN TestProvider_impl --- PASS: TestProvider_impl (0.00s) === RUN TestAccTritonFabric_basic --- PASS: TestAccTritonFabric_basic (15.11s) === RUN TestAccTritonFirewallRule_basic --- PASS: TestAccTritonFirewallRule_basic (1.48s) === RUN TestAccTritonFirewallRule_update --- PASS: TestAccTritonFirewallRule_update (1.55s) === RUN TestAccTritonFirewallRule_enable --- PASS: TestAccTritonFirewallRule_enable (1.52s) === RUN TestAccTritonKey_basic --- PASS: TestAccTritonKey_basic (11.76s) === RUN TestAccTritonKey_noKeyName --- PASS: TestAccTritonKey_noKeyName (11.20s) === RUN TestAccTritonMachine_basic --- PASS: TestAccTritonMachine_basic (82.19s) === RUN TestAccTritonMachine_dns --- PASS: TestAccTritonMachine_dns (173.36s) === RUN TestAccTritonMachine_nic --- PASS: TestAccTritonMachine_nic (167.82s) === RUN TestAccTritonMachine_addNIC --- PASS: TestAccTritonMachine_addNIC (192.11s) === RUN TestAccTritonMachine_firewall --- PASS: TestAccTritonMachine_firewall (188.53s) === RUN TestAccTritonMachine_metadata --- PASS: TestAccTritonMachine_metadata (614.57s) === RUN TestAccTritonVLAN_basic --- PASS: TestAccTritonVLAN_basic (0.93s) === RUN TestAccTritonVLAN_update --- PASS: TestAccTritonVLAN_update (1.50s) PASS ok github.com/hashicorp/terraform/builtin/providers/triton 1463.621s ``` * provider/triton: Update docs for provider config * deps: Vendor github.com/joyent/triton-go/... * deps: Remove github.com/joyent/gosdc
2017-03-31 00:25:27 +02:00
type Config struct {
Account string
KeyMaterial string
KeyID string
URL string
InsecureSkipTLSVerify bool
}
provider/triton: Move to joyent/triton-go (#13225) * provider/triton: Move to joyent/triton-go This commit moves the Triton provider to the new joyent/triton-go library from gosdc. This has a number of advantages - not least that requests can be signed using an SSH agent without having to keep unencrypted key material in memory. Schema has been maintained for all resources, and several tests have been added and acceptance tests repaired - in some cases by fixing bugs in the underlying resources. After applying this patch, all acceptance tests pass: ``` go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/30 13:48:33 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/triton -v -timeout 120m === RUN TestProvider --- PASS: TestProvider (0.00s) === RUN TestProvider_impl --- PASS: TestProvider_impl (0.00s) === RUN TestAccTritonFabric_basic --- PASS: TestAccTritonFabric_basic (15.11s) === RUN TestAccTritonFirewallRule_basic --- PASS: TestAccTritonFirewallRule_basic (1.48s) === RUN TestAccTritonFirewallRule_update --- PASS: TestAccTritonFirewallRule_update (1.55s) === RUN TestAccTritonFirewallRule_enable --- PASS: TestAccTritonFirewallRule_enable (1.52s) === RUN TestAccTritonKey_basic --- PASS: TestAccTritonKey_basic (11.76s) === RUN TestAccTritonKey_noKeyName --- PASS: TestAccTritonKey_noKeyName (11.20s) === RUN TestAccTritonMachine_basic --- PASS: TestAccTritonMachine_basic (82.19s) === RUN TestAccTritonMachine_dns --- PASS: TestAccTritonMachine_dns (173.36s) === RUN TestAccTritonMachine_nic --- PASS: TestAccTritonMachine_nic (167.82s) === RUN TestAccTritonMachine_addNIC --- PASS: TestAccTritonMachine_addNIC (192.11s) === RUN TestAccTritonMachine_firewall --- PASS: TestAccTritonMachine_firewall (188.53s) === RUN TestAccTritonMachine_metadata --- PASS: TestAccTritonMachine_metadata (614.57s) === RUN TestAccTritonVLAN_basic --- PASS: TestAccTritonVLAN_basic (0.93s) === RUN TestAccTritonVLAN_update --- PASS: TestAccTritonVLAN_update (1.50s) PASS ok github.com/hashicorp/terraform/builtin/providers/triton 1463.621s ``` * provider/triton: Update docs for provider config * deps: Vendor github.com/joyent/triton-go/... * deps: Remove github.com/joyent/gosdc
2017-03-31 00:25:27 +02:00
func (c Config) validate() error {
var err *multierror.Error
if c.URL == "" {
provider/triton: Move to joyent/triton-go (#13225) * provider/triton: Move to joyent/triton-go This commit moves the Triton provider to the new joyent/triton-go library from gosdc. This has a number of advantages - not least that requests can be signed using an SSH agent without having to keep unencrypted key material in memory. Schema has been maintained for all resources, and several tests have been added and acceptance tests repaired - in some cases by fixing bugs in the underlying resources. After applying this patch, all acceptance tests pass: ``` go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/30 13:48:33 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/triton -v -timeout 120m === RUN TestProvider --- PASS: TestProvider (0.00s) === RUN TestProvider_impl --- PASS: TestProvider_impl (0.00s) === RUN TestAccTritonFabric_basic --- PASS: TestAccTritonFabric_basic (15.11s) === RUN TestAccTritonFirewallRule_basic --- PASS: TestAccTritonFirewallRule_basic (1.48s) === RUN TestAccTritonFirewallRule_update --- PASS: TestAccTritonFirewallRule_update (1.55s) === RUN TestAccTritonFirewallRule_enable --- PASS: TestAccTritonFirewallRule_enable (1.52s) === RUN TestAccTritonKey_basic --- PASS: TestAccTritonKey_basic (11.76s) === RUN TestAccTritonKey_noKeyName --- PASS: TestAccTritonKey_noKeyName (11.20s) === RUN TestAccTritonMachine_basic --- PASS: TestAccTritonMachine_basic (82.19s) === RUN TestAccTritonMachine_dns --- PASS: TestAccTritonMachine_dns (173.36s) === RUN TestAccTritonMachine_nic --- PASS: TestAccTritonMachine_nic (167.82s) === RUN TestAccTritonMachine_addNIC --- PASS: TestAccTritonMachine_addNIC (192.11s) === RUN TestAccTritonMachine_firewall --- PASS: TestAccTritonMachine_firewall (188.53s) === RUN TestAccTritonMachine_metadata --- PASS: TestAccTritonMachine_metadata (614.57s) === RUN TestAccTritonVLAN_basic --- PASS: TestAccTritonVLAN_basic (0.93s) === RUN TestAccTritonVLAN_update --- PASS: TestAccTritonVLAN_update (1.50s) PASS ok github.com/hashicorp/terraform/builtin/providers/triton 1463.621s ``` * provider/triton: Update docs for provider config * deps: Vendor github.com/joyent/triton-go/... * deps: Remove github.com/joyent/gosdc
2017-03-31 00:25:27 +02:00
err = multierror.Append(err, errors.New("URL must be configured for the Triton provider"))
}
if c.KeyID == "" {
provider/triton: Move to joyent/triton-go (#13225) * provider/triton: Move to joyent/triton-go This commit moves the Triton provider to the new joyent/triton-go library from gosdc. This has a number of advantages - not least that requests can be signed using an SSH agent without having to keep unencrypted key material in memory. Schema has been maintained for all resources, and several tests have been added and acceptance tests repaired - in some cases by fixing bugs in the underlying resources. After applying this patch, all acceptance tests pass: ``` go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/30 13:48:33 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/triton -v -timeout 120m === RUN TestProvider --- PASS: TestProvider (0.00s) === RUN TestProvider_impl --- PASS: TestProvider_impl (0.00s) === RUN TestAccTritonFabric_basic --- PASS: TestAccTritonFabric_basic (15.11s) === RUN TestAccTritonFirewallRule_basic --- PASS: TestAccTritonFirewallRule_basic (1.48s) === RUN TestAccTritonFirewallRule_update --- PASS: TestAccTritonFirewallRule_update (1.55s) === RUN TestAccTritonFirewallRule_enable --- PASS: TestAccTritonFirewallRule_enable (1.52s) === RUN TestAccTritonKey_basic --- PASS: TestAccTritonKey_basic (11.76s) === RUN TestAccTritonKey_noKeyName --- PASS: TestAccTritonKey_noKeyName (11.20s) === RUN TestAccTritonMachine_basic --- PASS: TestAccTritonMachine_basic (82.19s) === RUN TestAccTritonMachine_dns --- PASS: TestAccTritonMachine_dns (173.36s) === RUN TestAccTritonMachine_nic --- PASS: TestAccTritonMachine_nic (167.82s) === RUN TestAccTritonMachine_addNIC --- PASS: TestAccTritonMachine_addNIC (192.11s) === RUN TestAccTritonMachine_firewall --- PASS: TestAccTritonMachine_firewall (188.53s) === RUN TestAccTritonMachine_metadata --- PASS: TestAccTritonMachine_metadata (614.57s) === RUN TestAccTritonVLAN_basic --- PASS: TestAccTritonVLAN_basic (0.93s) === RUN TestAccTritonVLAN_update --- PASS: TestAccTritonVLAN_update (1.50s) PASS ok github.com/hashicorp/terraform/builtin/providers/triton 1463.621s ``` * provider/triton: Update docs for provider config * deps: Vendor github.com/joyent/triton-go/... * deps: Remove github.com/joyent/gosdc
2017-03-31 00:25:27 +02:00
err = multierror.Append(err, errors.New("Key ID must be configured for the Triton provider"))
}
if c.Account == "" {
provider/triton: Move to joyent/triton-go (#13225) * provider/triton: Move to joyent/triton-go This commit moves the Triton provider to the new joyent/triton-go library from gosdc. This has a number of advantages - not least that requests can be signed using an SSH agent without having to keep unencrypted key material in memory. Schema has been maintained for all resources, and several tests have been added and acceptance tests repaired - in some cases by fixing bugs in the underlying resources. After applying this patch, all acceptance tests pass: ``` go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/30 13:48:33 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/triton -v -timeout 120m === RUN TestProvider --- PASS: TestProvider (0.00s) === RUN TestProvider_impl --- PASS: TestProvider_impl (0.00s) === RUN TestAccTritonFabric_basic --- PASS: TestAccTritonFabric_basic (15.11s) === RUN TestAccTritonFirewallRule_basic --- PASS: TestAccTritonFirewallRule_basic (1.48s) === RUN TestAccTritonFirewallRule_update --- PASS: TestAccTritonFirewallRule_update (1.55s) === RUN TestAccTritonFirewallRule_enable --- PASS: TestAccTritonFirewallRule_enable (1.52s) === RUN TestAccTritonKey_basic --- PASS: TestAccTritonKey_basic (11.76s) === RUN TestAccTritonKey_noKeyName --- PASS: TestAccTritonKey_noKeyName (11.20s) === RUN TestAccTritonMachine_basic --- PASS: TestAccTritonMachine_basic (82.19s) === RUN TestAccTritonMachine_dns --- PASS: TestAccTritonMachine_dns (173.36s) === RUN TestAccTritonMachine_nic --- PASS: TestAccTritonMachine_nic (167.82s) === RUN TestAccTritonMachine_addNIC --- PASS: TestAccTritonMachine_addNIC (192.11s) === RUN TestAccTritonMachine_firewall --- PASS: TestAccTritonMachine_firewall (188.53s) === RUN TestAccTritonMachine_metadata --- PASS: TestAccTritonMachine_metadata (614.57s) === RUN TestAccTritonVLAN_basic --- PASS: TestAccTritonVLAN_basic (0.93s) === RUN TestAccTritonVLAN_update --- PASS: TestAccTritonVLAN_update (1.50s) PASS ok github.com/hashicorp/terraform/builtin/providers/triton 1463.621s ``` * provider/triton: Update docs for provider config * deps: Vendor github.com/joyent/triton-go/... * deps: Remove github.com/joyent/gosdc
2017-03-31 00:25:27 +02:00
err = multierror.Append(err, errors.New("Account must be configured for the Triton provider"))
}
return err.ErrorOrNil()
}
provider/triton: Move to joyent/triton-go (#13225) * provider/triton: Move to joyent/triton-go This commit moves the Triton provider to the new joyent/triton-go library from gosdc. This has a number of advantages - not least that requests can be signed using an SSH agent without having to keep unencrypted key material in memory. Schema has been maintained for all resources, and several tests have been added and acceptance tests repaired - in some cases by fixing bugs in the underlying resources. After applying this patch, all acceptance tests pass: ``` go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/30 13:48:33 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/triton -v -timeout 120m === RUN TestProvider --- PASS: TestProvider (0.00s) === RUN TestProvider_impl --- PASS: TestProvider_impl (0.00s) === RUN TestAccTritonFabric_basic --- PASS: TestAccTritonFabric_basic (15.11s) === RUN TestAccTritonFirewallRule_basic --- PASS: TestAccTritonFirewallRule_basic (1.48s) === RUN TestAccTritonFirewallRule_update --- PASS: TestAccTritonFirewallRule_update (1.55s) === RUN TestAccTritonFirewallRule_enable --- PASS: TestAccTritonFirewallRule_enable (1.52s) === RUN TestAccTritonKey_basic --- PASS: TestAccTritonKey_basic (11.76s) === RUN TestAccTritonKey_noKeyName --- PASS: TestAccTritonKey_noKeyName (11.20s) === RUN TestAccTritonMachine_basic --- PASS: TestAccTritonMachine_basic (82.19s) === RUN TestAccTritonMachine_dns --- PASS: TestAccTritonMachine_dns (173.36s) === RUN TestAccTritonMachine_nic --- PASS: TestAccTritonMachine_nic (167.82s) === RUN TestAccTritonMachine_addNIC --- PASS: TestAccTritonMachine_addNIC (192.11s) === RUN TestAccTritonMachine_firewall --- PASS: TestAccTritonMachine_firewall (188.53s) === RUN TestAccTritonMachine_metadata --- PASS: TestAccTritonMachine_metadata (614.57s) === RUN TestAccTritonVLAN_basic --- PASS: TestAccTritonVLAN_basic (0.93s) === RUN TestAccTritonVLAN_update --- PASS: TestAccTritonVLAN_update (1.50s) PASS ok github.com/hashicorp/terraform/builtin/providers/triton 1463.621s ``` * provider/triton: Update docs for provider config * deps: Vendor github.com/joyent/triton-go/... * deps: Remove github.com/joyent/gosdc
2017-03-31 00:25:27 +02:00
func (c Config) getTritonClient() (*triton.Client, error) {
var signer authentication.Signer
var err error
if c.KeyMaterial == "" {
signer, err = authentication.NewSSHAgentSigner(c.KeyID, c.Account)
if err != nil {
return nil, errwrap.Wrapf("Error Creating SSH Agent Signer: {{err}}", err)
}
} else {
signer, err = authentication.NewPrivateKeySigner(c.KeyID, []byte(c.KeyMaterial), c.Account)
if err != nil {
return nil, errwrap.Wrapf("Error Creating SSH Private Key Signer: {{err}}", err)
}
}
provider/triton: Move to joyent/triton-go (#13225) * provider/triton: Move to joyent/triton-go This commit moves the Triton provider to the new joyent/triton-go library from gosdc. This has a number of advantages - not least that requests can be signed using an SSH agent without having to keep unencrypted key material in memory. Schema has been maintained for all resources, and several tests have been added and acceptance tests repaired - in some cases by fixing bugs in the underlying resources. After applying this patch, all acceptance tests pass: ``` go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/30 13:48:33 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/triton -v -timeout 120m === RUN TestProvider --- PASS: TestProvider (0.00s) === RUN TestProvider_impl --- PASS: TestProvider_impl (0.00s) === RUN TestAccTritonFabric_basic --- PASS: TestAccTritonFabric_basic (15.11s) === RUN TestAccTritonFirewallRule_basic --- PASS: TestAccTritonFirewallRule_basic (1.48s) === RUN TestAccTritonFirewallRule_update --- PASS: TestAccTritonFirewallRule_update (1.55s) === RUN TestAccTritonFirewallRule_enable --- PASS: TestAccTritonFirewallRule_enable (1.52s) === RUN TestAccTritonKey_basic --- PASS: TestAccTritonKey_basic (11.76s) === RUN TestAccTritonKey_noKeyName --- PASS: TestAccTritonKey_noKeyName (11.20s) === RUN TestAccTritonMachine_basic --- PASS: TestAccTritonMachine_basic (82.19s) === RUN TestAccTritonMachine_dns --- PASS: TestAccTritonMachine_dns (173.36s) === RUN TestAccTritonMachine_nic --- PASS: TestAccTritonMachine_nic (167.82s) === RUN TestAccTritonMachine_addNIC --- PASS: TestAccTritonMachine_addNIC (192.11s) === RUN TestAccTritonMachine_firewall --- PASS: TestAccTritonMachine_firewall (188.53s) === RUN TestAccTritonMachine_metadata --- PASS: TestAccTritonMachine_metadata (614.57s) === RUN TestAccTritonVLAN_basic --- PASS: TestAccTritonVLAN_basic (0.93s) === RUN TestAccTritonVLAN_update --- PASS: TestAccTritonVLAN_update (1.50s) PASS ok github.com/hashicorp/terraform/builtin/providers/triton 1463.621s ``` * provider/triton: Update docs for provider config * deps: Vendor github.com/joyent/triton-go/... * deps: Remove github.com/joyent/gosdc
2017-03-31 00:25:27 +02:00
client, err := triton.NewClient(c.URL, c.Account, signer)
if err != nil {
return nil, errwrap.Wrapf("Error Creating Triton Client: {{err}}", err)
}
if c.InsecureSkipTLSVerify {
client.InsecureSkipTLSVerify()
}
return client, nil
}
func providerConfigure(d *schema.ResourceData) (interface{}, error) {
provider/triton: Move to joyent/triton-go (#13225) * provider/triton: Move to joyent/triton-go This commit moves the Triton provider to the new joyent/triton-go library from gosdc. This has a number of advantages - not least that requests can be signed using an SSH agent without having to keep unencrypted key material in memory. Schema has been maintained for all resources, and several tests have been added and acceptance tests repaired - in some cases by fixing bugs in the underlying resources. After applying this patch, all acceptance tests pass: ``` go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/30 13:48:33 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/triton -v -timeout 120m === RUN TestProvider --- PASS: TestProvider (0.00s) === RUN TestProvider_impl --- PASS: TestProvider_impl (0.00s) === RUN TestAccTritonFabric_basic --- PASS: TestAccTritonFabric_basic (15.11s) === RUN TestAccTritonFirewallRule_basic --- PASS: TestAccTritonFirewallRule_basic (1.48s) === RUN TestAccTritonFirewallRule_update --- PASS: TestAccTritonFirewallRule_update (1.55s) === RUN TestAccTritonFirewallRule_enable --- PASS: TestAccTritonFirewallRule_enable (1.52s) === RUN TestAccTritonKey_basic --- PASS: TestAccTritonKey_basic (11.76s) === RUN TestAccTritonKey_noKeyName --- PASS: TestAccTritonKey_noKeyName (11.20s) === RUN TestAccTritonMachine_basic --- PASS: TestAccTritonMachine_basic (82.19s) === RUN TestAccTritonMachine_dns --- PASS: TestAccTritonMachine_dns (173.36s) === RUN TestAccTritonMachine_nic --- PASS: TestAccTritonMachine_nic (167.82s) === RUN TestAccTritonMachine_addNIC --- PASS: TestAccTritonMachine_addNIC (192.11s) === RUN TestAccTritonMachine_firewall --- PASS: TestAccTritonMachine_firewall (188.53s) === RUN TestAccTritonMachine_metadata --- PASS: TestAccTritonMachine_metadata (614.57s) === RUN TestAccTritonVLAN_basic --- PASS: TestAccTritonVLAN_basic (0.93s) === RUN TestAccTritonVLAN_update --- PASS: TestAccTritonVLAN_update (1.50s) PASS ok github.com/hashicorp/terraform/builtin/providers/triton 1463.621s ``` * provider/triton: Update docs for provider config * deps: Vendor github.com/joyent/triton-go/... * deps: Remove github.com/joyent/gosdc
2017-03-31 00:25:27 +02:00
config := Config{
Account: d.Get("account").(string),
URL: d.Get("url").(string),
KeyID: d.Get("key_id").(string),
InsecureSkipTLSVerify: d.Get("insecure_skip_tls_verify").(bool),
provider/triton: Move to joyent/triton-go (#13225) * provider/triton: Move to joyent/triton-go This commit moves the Triton provider to the new joyent/triton-go library from gosdc. This has a number of advantages - not least that requests can be signed using an SSH agent without having to keep unencrypted key material in memory. Schema has been maintained for all resources, and several tests have been added and acceptance tests repaired - in some cases by fixing bugs in the underlying resources. After applying this patch, all acceptance tests pass: ``` go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/30 13:48:33 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/triton -v -timeout 120m === RUN TestProvider --- PASS: TestProvider (0.00s) === RUN TestProvider_impl --- PASS: TestProvider_impl (0.00s) === RUN TestAccTritonFabric_basic --- PASS: TestAccTritonFabric_basic (15.11s) === RUN TestAccTritonFirewallRule_basic --- PASS: TestAccTritonFirewallRule_basic (1.48s) === RUN TestAccTritonFirewallRule_update --- PASS: TestAccTritonFirewallRule_update (1.55s) === RUN TestAccTritonFirewallRule_enable --- PASS: TestAccTritonFirewallRule_enable (1.52s) === RUN TestAccTritonKey_basic --- PASS: TestAccTritonKey_basic (11.76s) === RUN TestAccTritonKey_noKeyName --- PASS: TestAccTritonKey_noKeyName (11.20s) === RUN TestAccTritonMachine_basic --- PASS: TestAccTritonMachine_basic (82.19s) === RUN TestAccTritonMachine_dns --- PASS: TestAccTritonMachine_dns (173.36s) === RUN TestAccTritonMachine_nic --- PASS: TestAccTritonMachine_nic (167.82s) === RUN TestAccTritonMachine_addNIC --- PASS: TestAccTritonMachine_addNIC (192.11s) === RUN TestAccTritonMachine_firewall --- PASS: TestAccTritonMachine_firewall (188.53s) === RUN TestAccTritonMachine_metadata --- PASS: TestAccTritonMachine_metadata (614.57s) === RUN TestAccTritonVLAN_basic --- PASS: TestAccTritonVLAN_basic (0.93s) === RUN TestAccTritonVLAN_update --- PASS: TestAccTritonVLAN_update (1.50s) PASS ok github.com/hashicorp/terraform/builtin/providers/triton 1463.621s ``` * provider/triton: Update docs for provider config * deps: Vendor github.com/joyent/triton-go/... * deps: Remove github.com/joyent/gosdc
2017-03-31 00:25:27 +02:00
}
if keyMaterial, ok := d.GetOk("key_material"); ok {
config.KeyMaterial = keyMaterial.(string)
}
if err := config.validate(); err != nil {
return nil, err
}
provider/triton: Move to joyent/triton-go (#13225) * provider/triton: Move to joyent/triton-go This commit moves the Triton provider to the new joyent/triton-go library from gosdc. This has a number of advantages - not least that requests can be signed using an SSH agent without having to keep unencrypted key material in memory. Schema has been maintained for all resources, and several tests have been added and acceptance tests repaired - in some cases by fixing bugs in the underlying resources. After applying this patch, all acceptance tests pass: ``` go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/30 13:48:33 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/triton -v -timeout 120m === RUN TestProvider --- PASS: TestProvider (0.00s) === RUN TestProvider_impl --- PASS: TestProvider_impl (0.00s) === RUN TestAccTritonFabric_basic --- PASS: TestAccTritonFabric_basic (15.11s) === RUN TestAccTritonFirewallRule_basic --- PASS: TestAccTritonFirewallRule_basic (1.48s) === RUN TestAccTritonFirewallRule_update --- PASS: TestAccTritonFirewallRule_update (1.55s) === RUN TestAccTritonFirewallRule_enable --- PASS: TestAccTritonFirewallRule_enable (1.52s) === RUN TestAccTritonKey_basic --- PASS: TestAccTritonKey_basic (11.76s) === RUN TestAccTritonKey_noKeyName --- PASS: TestAccTritonKey_noKeyName (11.20s) === RUN TestAccTritonMachine_basic --- PASS: TestAccTritonMachine_basic (82.19s) === RUN TestAccTritonMachine_dns --- PASS: TestAccTritonMachine_dns (173.36s) === RUN TestAccTritonMachine_nic --- PASS: TestAccTritonMachine_nic (167.82s) === RUN TestAccTritonMachine_addNIC --- PASS: TestAccTritonMachine_addNIC (192.11s) === RUN TestAccTritonMachine_firewall --- PASS: TestAccTritonMachine_firewall (188.53s) === RUN TestAccTritonMachine_metadata --- PASS: TestAccTritonMachine_metadata (614.57s) === RUN TestAccTritonVLAN_basic --- PASS: TestAccTritonVLAN_basic (0.93s) === RUN TestAccTritonVLAN_update --- PASS: TestAccTritonVLAN_update (1.50s) PASS ok github.com/hashicorp/terraform/builtin/providers/triton 1463.621s ``` * provider/triton: Update docs for provider config * deps: Vendor github.com/joyent/triton-go/... * deps: Remove github.com/joyent/gosdc
2017-03-31 00:25:27 +02:00
client, err := config.getTritonClient()
if err != nil {
return nil, err
}
return client, nil
}
provider/triton: Move to joyent/triton-go (#13225) * provider/triton: Move to joyent/triton-go This commit moves the Triton provider to the new joyent/triton-go library from gosdc. This has a number of advantages - not least that requests can be signed using an SSH agent without having to keep unencrypted key material in memory. Schema has been maintained for all resources, and several tests have been added and acceptance tests repaired - in some cases by fixing bugs in the underlying resources. After applying this patch, all acceptance tests pass: ``` go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/30 13:48:33 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/triton -v -timeout 120m === RUN TestProvider --- PASS: TestProvider (0.00s) === RUN TestProvider_impl --- PASS: TestProvider_impl (0.00s) === RUN TestAccTritonFabric_basic --- PASS: TestAccTritonFabric_basic (15.11s) === RUN TestAccTritonFirewallRule_basic --- PASS: TestAccTritonFirewallRule_basic (1.48s) === RUN TestAccTritonFirewallRule_update --- PASS: TestAccTritonFirewallRule_update (1.55s) === RUN TestAccTritonFirewallRule_enable --- PASS: TestAccTritonFirewallRule_enable (1.52s) === RUN TestAccTritonKey_basic --- PASS: TestAccTritonKey_basic (11.76s) === RUN TestAccTritonKey_noKeyName --- PASS: TestAccTritonKey_noKeyName (11.20s) === RUN TestAccTritonMachine_basic --- PASS: TestAccTritonMachine_basic (82.19s) === RUN TestAccTritonMachine_dns --- PASS: TestAccTritonMachine_dns (173.36s) === RUN TestAccTritonMachine_nic --- PASS: TestAccTritonMachine_nic (167.82s) === RUN TestAccTritonMachine_addNIC --- PASS: TestAccTritonMachine_addNIC (192.11s) === RUN TestAccTritonMachine_firewall --- PASS: TestAccTritonMachine_firewall (188.53s) === RUN TestAccTritonMachine_metadata --- PASS: TestAccTritonMachine_metadata (614.57s) === RUN TestAccTritonVLAN_basic --- PASS: TestAccTritonVLAN_basic (0.93s) === RUN TestAccTritonVLAN_update --- PASS: TestAccTritonVLAN_update (1.50s) PASS ok github.com/hashicorp/terraform/builtin/providers/triton 1463.621s ``` * provider/triton: Update docs for provider config * deps: Vendor github.com/joyent/triton-go/... * deps: Remove github.com/joyent/gosdc
2017-03-31 00:25:27 +02:00
func resourceExists(resource interface{}, err error) (bool, error) {
if err != nil {
if triton.IsResourceNotFound(err) {
return false, nil
}
return false, err
}
return resource != nil, nil
}
func stableMapHash(input map[string]string) string {
keys := make([]string, 0, len(input))
for k := range input {
keys = append(keys, k)
}
sort.Strings(keys)
hash := md5.New()
for _, key := range keys {
hash.Write([]byte(key))
hash.Write([]byte(input[key]))
}
return base64.StdEncoding.EncodeToString(hash.Sum([]byte{}))
}
var fastResourceTimeout = &schema.ResourceTimeout{
Create: schema.DefaultTimeout(1 * time.Minute),
Read: schema.DefaultTimeout(30 * time.Second),
Update: schema.DefaultTimeout(1 * time.Minute),
Delete: schema.DefaultTimeout(1 * time.Minute),
}
var slowResourceTimeout = &schema.ResourceTimeout{
Create: schema.DefaultTimeout(10 * time.Minute),
Read: schema.DefaultTimeout(30 * time.Second),
Update: schema.DefaultTimeout(10 * time.Minute),
Delete: schema.DefaultTimeout(10 * time.Minute),
}