Merge branch 'b-triton-dot-in-tags' of https://github.com/zeroae/terraform into zeroae-b-triton-dot-in-tags

This commit is contained in:
James Nugent 2016-07-12 15:06:47 -06:00
commit b688512133
1 changed files with 50 additions and 16 deletions

View File

@ -263,6 +263,8 @@ func TestAccTritonMachine_metadata(t *testing.T) {
machineName := fmt.Sprintf("acctest-%d", acctest.RandInt())
basic := fmt.Sprintf(testAccTritonMachine_metadata_1, machineName)
add_metadata := fmt.Sprintf(testAccTritonMachine_metadata_1, machineName)
add_metadata_2 := fmt.Sprintf(testAccTritonMachine_metadata_2, machineName)
add_metadata_3 := fmt.Sprintf(testAccTritonMachine_metadata_3, machineName)
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
@ -283,15 +285,29 @@ func TestAccTritonMachine_metadata(t *testing.T) {
"triton_machine.test", "user_data", "hello"),
),
},
resource.TestStep{
Config: add_metadata_2,
Check: resource.ComposeTestCheckFunc(
testCheckTritonMachineExists("triton_machine.test"),
resource.TestCheckResourceAttr(
"triton_machine.test",
"tags.triton.cns.services", "test-cns-service"),
),
},
resource.TestStep{
Config: add_metadata_3,
Check: resource.ComposeTestCheckFunc(
testCheckTritonMachineExists("triton_machine.test"),
resource.TestCheckResourceAttr(
"triton_machine.test",
"tags.triton.cns.services", "test-cns-service"),
),
},
},
})
}
var testAccTritonMachine_basic = `
provider "triton" {
url = "https://us-west-1.api.joyentcloud.com"
}
resource "triton_machine" "test" {
name = "%s"
package = "g4-general-4G"
@ -304,10 +320,6 @@ resource "triton_machine" "test" {
`
var testAccTritonMachine_firewall_0 = `
provider "triton" {
url = "https://us-west-1.api.joyentcloud.com"
}
resource "triton_machine" "test" {
name = "%s"
package = "g4-general-4G"
@ -317,10 +329,6 @@ resource "triton_machine" "test" {
}
`
var testAccTritonMachine_firewall_1 = `
provider "triton" {
url = "https://us-west-1.api.joyentcloud.com"
}
resource "triton_machine" "test" {
name = "%s"
package = "g4-general-4G"
@ -331,10 +339,6 @@ resource "triton_machine" "test" {
`
var testAccTritonMachine_metadata_1 = `
provider "triton" {
url = "https://us-west-1.api.joyentcloud.com"
}
resource "triton_machine" "test" {
name = "%s"
package = "g4-general-4G"
@ -347,7 +351,37 @@ resource "triton_machine" "test" {
}
}
`
var testAccTritonMachine_metadata_2 = `
variable "tags" {
default = {
test = "hello!"
triton.cns.services = "test-cns-service"
}
}
resource "triton_machine" "test" {
name = "%s"
package = "g4-highcpu-128M"
image = "c20b4b7c-e1a6-11e5-9a4d-ef590901732e"
user_data = "hello"
tags = "${var.tags}"
}
`
var testAccTritonMachine_metadata_3 = `
resource "triton_machine" "test" {
name = "%s"
package = "g4-highcpu-128M"
image = "c20b4b7c-e1a6-11e5-9a4d-ef590901732e"
user_data = "hello"
tags = {
test = "hello!"
triton.cns.services = "test-cns-service"
}
}
`
var testAccTritonMachine_withnic = `
resource "triton_fabric" "test" {
name = "%s-network"