func TestAccAWSRoute53HealthCheck_basic(t *testing.T) {
	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccCheckRoute53HealthCheckDestroy,
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: testAccRoute53HealthCheckConfig,
				Check: resource.ComposeTestCheckFunc(
					testAccCheckRoute53HealthCheckExists("aws_route53_health_check.foo"),
					resource.TestCheckResourceAttr(
						"aws_route53_health_check.foo", "measure_latency", "true"),
					resource.TestCheckResourceAttr(
						"aws_route53_health_check.foo", "invert_healthcheck", "true"),
				),
			},
			resource.TestStep{
				Config: testAccRoute53HealthCheckConfigUpdate,
				Check: resource.ComposeTestCheckFunc(
					testAccCheckRoute53HealthCheckExists("aws_route53_health_check.foo"),
					resource.TestCheckResourceAttr(
						"aws_route53_health_check.foo", "failure_threshold", "5"),
					resource.TestCheckResourceAttr(
						"aws_route53_health_check.foo", "invert_healthcheck", "false"),
				),
			},
		},
	})
}
func TestAccAWSLambdaEventSourceMapping_basic(t *testing.T) {
	var conf lambda.EventSourceMappingConfiguration

	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccCheckLambdaEventSourceMappingDestroy,
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: testAccAWSLambdaEventSourceMappingConfig,
				Check: resource.ComposeTestCheckFunc(
					testAccCheckAwsLambdaEventSourceMappingExists("aws_lambda_event_source_mapping.lambda_event_source_mapping_test", &conf),
					testAccCheckAWSLambdaEventSourceMappingAttributes(&conf),
				),
			},
			resource.TestStep{
				Config: testAccAWSLambdaEventSourceMappingConfigUpdate,
				Check: resource.ComposeTestCheckFunc(
					testAccCheckAwsLambdaEventSourceMappingExists("aws_lambda_event_source_mapping.lambda_event_source_mapping_test", &conf),
					resource.TestCheckResourceAttr("aws_lambda_event_source_mapping.lambda_event_source_mapping_test",
						"batch_size",
						strconv.Itoa(200)),
					resource.TestCheckResourceAttr("aws_lambda_event_source_mapping.lambda_event_source_mapping_test",
						"enabled",
						strconv.FormatBool(false)),
					resource.TestMatchResourceAttr(
						"aws_lambda_event_source_mapping.lambda_event_source_mapping_test",
						"function_arn",
						regexp.MustCompile("example_lambda_name_update$"),
					),
				),
			},
		},
	})
}
func TestAccHerokuApp_NukeVars(t *testing.T) {
	var app heroku.App
	appName := fmt.Sprintf("tftest-%s", acctest.RandString(10))

	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccCheckHerokuAppDestroy,
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: testAccCheckHerokuAppConfig_basic(appName),
				Check: resource.ComposeTestCheckFunc(
					testAccCheckHerokuAppExists("heroku_app.foobar", &app),
					testAccCheckHerokuAppAttributes(&app, appName),
					resource.TestCheckResourceAttr(
						"heroku_app.foobar", "name", appName),
					resource.TestCheckResourceAttr(
						"heroku_app.foobar", "config_vars.0.FOO", "bar"),
				),
			},
			resource.TestStep{
				Config: testAccCheckHerokuAppConfig_no_vars(appName),
				Check: resource.ComposeTestCheckFunc(
					testAccCheckHerokuAppExists("heroku_app.foobar", &app),
					testAccCheckHerokuAppAttributesNoVars(&app, appName),
					resource.TestCheckResourceAttr(
						"heroku_app.foobar", "name", appName),
					resource.TestCheckResourceAttr(
						"heroku_app.foobar", "config_vars.0.FOO", ""),
				),
			},
		},
	})
}
func TestAccDNSimpleRecord_Basic(t *testing.T) {
	var record dnsimple.Record
	domain := os.Getenv("DNSIMPLE_DOMAIN")

	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccCheckDNSimpleRecordDestroy,
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: fmt.Sprintf(testAccCheckDNSimpleRecordConfig_basic, domain),
				Check: resource.ComposeTestCheckFunc(
					testAccCheckDNSimpleRecordExists("dnsimple_record.foobar", &record),
					testAccCheckDNSimpleRecordAttributes(&record),
					resource.TestCheckResourceAttr(
						"dnsimple_record.foobar", "name", "terraform"),
					resource.TestCheckResourceAttr(
						"dnsimple_record.foobar", "domain", domain),
					resource.TestCheckResourceAttr(
						"dnsimple_record.foobar", "value", "192.168.0.10"),
				),
			},
		},
	})
}
func TestAccAWSElasticacheCluster_decreasingCacheNodes(t *testing.T) {
	var ec elasticache.CacheCluster

	ri := genRandInt()
	preConfig := fmt.Sprintf(testAccAWSElasticacheClusterConfigDecreasingNodes, ri, ri, ri)
	postConfig := fmt.Sprintf(testAccAWSElasticacheClusterConfigDecreasingNodes_update, ri, ri, ri)

	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccCheckAWSElasticacheClusterDestroy,
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: preConfig,
				Check: resource.ComposeTestCheckFunc(
					testAccCheckAWSElasticacheSecurityGroupExists("aws_elasticache_security_group.bar"),
					testAccCheckAWSElasticacheClusterExists("aws_elasticache_cluster.bar", &ec),
					resource.TestCheckResourceAttr(
						"aws_elasticache_cluster.bar", "num_cache_nodes", "3"),
				),
			},

			resource.TestStep{
				Config: postConfig,
				Check: resource.ComposeTestCheckFunc(
					testAccCheckAWSElasticacheSecurityGroupExists("aws_elasticache_security_group.bar"),
					testAccCheckAWSElasticacheClusterExists("aws_elasticache_cluster.bar", &ec),
					resource.TestCheckResourceAttr(
						"aws_elasticache_cluster.bar", "num_cache_nodes", "1"),
				),
			},
		},
	})
}
func TestAccAWSELB_SecurityGroups(t *testing.T) {
	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccCheckAWSELBDestroy,
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: testAccAWSELBConfig,
				Check: resource.ComposeTestCheckFunc(
					resource.TestCheckResourceAttr(
						"aws_elb.bar", "security_groups.#", "0",
					),
				),
			},
			resource.TestStep{
				Config: testAccAWSELBConfigSecurityGroups,
				Check: resource.ComposeTestCheckFunc(
					resource.TestCheckResourceAttr(
						"aws_elb.bar", "security_groups.#", "1",
					),
				),
			},
		},
	})
}
func TestAccDynRecord_Basic(t *testing.T) {
	var record dynect.Record
	zone := os.Getenv("DYN_ZONE")

	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccCheckDynRecordDestroy,
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: fmt.Sprintf(testAccCheckDynRecordConfig_basic, zone),
				Check: resource.ComposeTestCheckFunc(
					testAccCheckDynRecordExists("dyn_record.foobar", &record),
					testAccCheckDynRecordAttributes(&record),
					resource.TestCheckResourceAttr(
						"dyn_record.foobar", "name", "terraform"),
					resource.TestCheckResourceAttr(
						"dyn_record.foobar", "zone", zone),
					resource.TestCheckResourceAttr(
						"dyn_record.foobar", "value", "192.168.0.10"),
				),
			},
		},
	})
}
// GH-198
func TestAccHerokuAddon_noPlan(t *testing.T) {
	var addon heroku.Addon
	appName := fmt.Sprintf("tftest-%s", acctest.RandString(10))

	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccCheckHerokuAddonDestroy,
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: testAccCheckHerokuAddonConfig_no_plan(appName),
				Check: resource.ComposeTestCheckFunc(
					testAccCheckHerokuAddonExists("heroku_addon.foobar", &addon),
					testAccCheckHerokuAddonAttributes(&addon, "memcachier:dev"),
					resource.TestCheckResourceAttr(
						"heroku_addon.foobar", "app", appName),
					resource.TestCheckResourceAttr(
						"heroku_addon.foobar", "plan", "memcachier"),
				),
			},
			resource.TestStep{
				Config: testAccCheckHerokuAddonConfig_no_plan(appName),
				Check: resource.ComposeTestCheckFunc(
					testAccCheckHerokuAddonExists("heroku_addon.foobar", &addon),
					testAccCheckHerokuAddonAttributes(&addon, "memcachier:dev"),
					resource.TestCheckResourceAttr(
						"heroku_addon.foobar", "app", appName),
					resource.TestCheckResourceAttr(
						"heroku_addon.foobar", "plan", "memcachier"),
				),
			},
		},
	})
}
func TestAccAzureDnsServerUpdate(t *testing.T) {
	name := "azure_dns_server.foo"

	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccCheckAzureDnsServerDestroy,
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: testAccAzureDnsServerBasic,
				Check: resource.ComposeTestCheckFunc(
					testAccCheckAzureDnsServerExists(name),
					resource.TestCheckResourceAttr(name, "name", "terraform-dns-server"),
					resource.TestCheckResourceAttr(name, "dns_address", "8.8.8.8"),
				),
			},

			resource.TestStep{
				Config: testAccAzureDnsServerUpdate,
				Check: resource.ComposeTestCheckFunc(
					testAccCheckAzureDnsServerExists(name),
					resource.TestCheckResourceAttr(name, "name", "terraform-dns-server"),
					resource.TestCheckResourceAttr(name, "dns_address", "8.8.4.4"),
				),
			},
		},
	})
}
func TestAccAzureHostedServiceUpdate(t *testing.T) {
	name := "azure_hosted_service.foo"

	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccCheckAzureHostedServiceDestroyed,
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: testAccAzureHostedServiceBasic,
				Check: resource.ComposeTestCheckFunc(
					testAccCheckAzureHostedServiceExists(name),
					resource.TestCheckResourceAttr(name, "name", "terraform-testing-service"),
					resource.TestCheckResourceAttr(name, "location", "North Europe"),
					resource.TestCheckResourceAttr(name, "ephemeral_contents", "false"),
					resource.TestCheckResourceAttr(name, "description", "very discriptive"),
					resource.TestCheckResourceAttr(name, "label", "very identifiable"),
				),
			},

			resource.TestStep{
				Config: testAccAzureHostedServiceUpdate,
				Check: resource.ComposeTestCheckFunc(
					testAccCheckAzureHostedServiceExists(name),
					resource.TestCheckResourceAttr(name, "name", "terraform-testing-service"),
					resource.TestCheckResourceAttr(name, "location", "North Europe"),
					resource.TestCheckResourceAttr(name, "ephemeral_contents", "true"),
					resource.TestCheckResourceAttr(name, "description", "very discriptive"),
					resource.TestCheckResourceAttr(name, "label", "very identifiable"),
				),
			},
		},
	})
}
func TestAccHerokuAddon_Basic(t *testing.T) {
	var addon heroku.Addon
	appName := fmt.Sprintf("tftest-%s", acctest.RandString(10))

	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccCheckHerokuAddonDestroy,
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: testAccCheckHerokuAddonConfig_basic(appName),
				Check: resource.ComposeTestCheckFunc(
					testAccCheckHerokuAddonExists("heroku_addon.foobar", &addon),
					testAccCheckHerokuAddonAttributes(&addon, "deployhooks:http"),
					resource.TestCheckResourceAttr(
						"heroku_addon.foobar", "config.0.url", "http://google.com"),
					resource.TestCheckResourceAttr(
						"heroku_addon.foobar", "app", appName),
					resource.TestCheckResourceAttr(
						"heroku_addon.foobar", "plan", "deployhooks:http"),
				),
			},
		},
	})
}
func TestAccAWSDBSecurityGroup_basic(t *testing.T) {
	var v rds.DBSecurityGroup

	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccCheckAWSDBSecurityGroupDestroy,
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: testAccAWSDBSecurityGroupConfig,
				Check: resource.ComposeTestCheckFunc(
					testAccCheckAWSDBSecurityGroupExists("aws_db_security_group.bar", &v),
					testAccCheckAWSDBSecurityGroupAttributes(&v),
					resource.TestCheckResourceAttr(
						"aws_db_security_group.bar", "name", "secgroup-terraform"),
					resource.TestCheckResourceAttr(
						"aws_db_security_group.bar", "description", "just cuz"),
					resource.TestCheckResourceAttr(
						"aws_db_security_group.bar", "ingress.3363517775.cidr", "10.0.0.1/24"),
					resource.TestCheckResourceAttr(
						"aws_db_security_group.bar", "ingress.#", "1"),
					resource.TestCheckResourceAttr(
						"aws_db_security_group.bar", "tags.#", "1"),
				),
			},
		},
	})
}
func TestAccVSphereVirtualMachine_custom_configs(t *testing.T) {
	var vm virtualMachine
	var locationOpt string
	var datastoreOpt string

	if v := os.Getenv("VSPHERE_DATACENTER"); v != "" {
		locationOpt += fmt.Sprintf("    datacenter = \"%s\"\n", v)
	}
	if v := os.Getenv("VSPHERE_CLUSTER"); v != "" {
		locationOpt += fmt.Sprintf("    cluster = \"%s\"\n", v)
	}
	if v := os.Getenv("VSPHERE_RESOURCE_POOL"); v != "" {
		locationOpt += fmt.Sprintf("    resource_pool = \"%s\"\n", v)
	}
	if v := os.Getenv("VSPHERE_DATASTORE"); v != "" {
		datastoreOpt = fmt.Sprintf("        datastore = \"%s\"\n", v)
	}
	template := os.Getenv("VSPHERE_TEMPLATE")
	label := os.Getenv("VSPHERE_NETWORK_LABEL_DHCP")

	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccCheckVSphereVirtualMachineDestroy,
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: fmt.Sprintf(
					testAccCheckVSphereVirtualMachineConfig_custom_configs,
					locationOpt,
					label,
					datastoreOpt,
					template,
				),
				Check: resource.ComposeTestCheckFunc(
					testAccCheckVSphereVirtualMachineExistsHasCustomConfig("vsphere_virtual_machine.car", &vm),
					resource.TestCheckResourceAttr(
						"vsphere_virtual_machine.car", "name", "terraform-test-custom"),
					resource.TestCheckResourceAttr(
						"vsphere_virtual_machine.car", "vcpu", "2"),
					resource.TestCheckResourceAttr(
						"vsphere_virtual_machine.car", "memory", "4096"),
					resource.TestCheckResourceAttr(
						"vsphere_virtual_machine.car", "disk.#", "1"),
					resource.TestCheckResourceAttr(
						"vsphere_virtual_machine.car", "disk.0.template", template),
					resource.TestCheckResourceAttr(
						"vsphere_virtual_machine.car", "network_interface.#", "1"),
					resource.TestCheckResourceAttr(
						"vsphere_virtual_machine.car", "custom_configuration_parameters.foo", "bar"),
					resource.TestCheckResourceAttr(
						"vsphere_virtual_machine.car", "custom_configuration_parameters.car", "ferrari"),
					resource.TestCheckResourceAttr(
						"vsphere_virtual_machine.car", "custom_configuration_parameters.num", "42"),
					resource.TestCheckResourceAttr(
						"vsphere_virtual_machine.car", "network_interface.0.label", label),
				),
			},
		},
	})
}
func TestAccCloudStackPortForward_basic(t *testing.T) {
	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccCheckCloudStackPortForwardDestroy,
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: testAccCloudStackPortForward_basic,
				Check: resource.ComposeTestCheckFunc(
					testAccCheckCloudStackPortForwardsExist("cloudstack_port_forward.foo"),
					resource.TestCheckResourceAttr(
						"cloudstack_port_forward.foo", "ipaddress", CLOUDSTACK_PUBLIC_IPADDRESS),
					resource.TestCheckResourceAttr(
						"cloudstack_port_forward.foo", "forward.952396423.protocol", "tcp"),
					resource.TestCheckResourceAttr(
						"cloudstack_port_forward.foo", "forward.952396423.private_port", "443"),
					resource.TestCheckResourceAttr(
						"cloudstack_port_forward.foo", "forward.952396423.public_port", "8443"),
					resource.TestCheckResourceAttr(
						"cloudstack_port_forward.foo", "forward.952396423.virtual_machine", "terraform-test"),
				),
			},
		},
	})
}
func TestAccAWSELB_HealthCheck(t *testing.T) {
	var conf elb.LoadBalancerDescription

	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccCheckAWSELBDestroy,
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: testAccAWSELBConfigHealthCheck,
				Check: resource.ComposeTestCheckFunc(
					testAccCheckAWSELBExists("aws_elb.bar", &conf),
					testAccCheckAWSELBAttributesHealthCheck(&conf),
					resource.TestCheckResourceAttr(
						"aws_elb.bar", "health_check.3484319807.healthy_threshold", "5"),
					resource.TestCheckResourceAttr(
						"aws_elb.bar", "health_check.3484319807.unhealthy_threshold", "5"),
					resource.TestCheckResourceAttr(
						"aws_elb.bar", "health_check.3484319807.target", "HTTP:8000/"),
					resource.TestCheckResourceAttr(
						"aws_elb.bar", "health_check.3484319807.timeout", "30"),
					resource.TestCheckResourceAttr(
						"aws_elb.bar", "health_check.3484319807.interval", "60"),
				),
			},
		},
	})
}
func TestAccAWSCodeCommitRepository_withChanges(t *testing.T) {
	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccCheckCodeCommitRepositoryDestroy,
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: testAccCodeCommitRepository_basic,
				Check: resource.ComposeTestCheckFunc(
					testAccCheckCodeCommitRepositoryExists("aws_codecommit_repository.test"),
					resource.TestCheckResourceAttr(
						"aws_codecommit_repository.test", "description", "This is a test description"),
				),
			},
			resource.TestStep{
				Config: testAccCodeCommitRepository_withChanges,
				Check: resource.ComposeTestCheckFunc(
					testAccCheckCodeCommitRepositoryExists("aws_codecommit_repository.test"),
					resource.TestCheckResourceAttr(
						"aws_codecommit_repository.test", "description", "This is a test description - with changes"),
				),
			},
		},
	})
}
func TestAccAWSELBUpdate_Timeout(t *testing.T) {
	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccCheckAWSELBDestroy,
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: testAccAWSELBConfigIdleTimeout,
				Check: resource.ComposeTestCheckFunc(
					resource.TestCheckResourceAttr(
						"aws_elb.bar", "idle_timeout", "200",
					),
				),
			},
			resource.TestStep{
				Config: testAccAWSELBConfigIdleTimeout_update,
				Check: resource.ComposeTestCheckFunc(
					resource.TestCheckResourceAttr(
						"aws_elb.bar", "idle_timeout", "400",
					),
				),
			},
		},
	})
}
func TestAccAzureInstance_separateHostedService(t *testing.T) {
	var dpmt virtualmachine.DeploymentResponse

	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccCheckAzureInstanceDestroyed(testAccHostedServiceName),
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: testAccAzureInstance_separateHostedService,
				Check: resource.ComposeTestCheckFunc(
					testAccCheckAzureInstanceExists(
						"azure_instance.foo", testAccHostedServiceName, &dpmt),
					testAccCheckAzureInstanceBasicAttributes(&dpmt),
					resource.TestCheckResourceAttr(
						"azure_instance.foo", "name", instanceName),
					resource.TestCheckResourceAttr(
						"azure_instance.foo", "hosted_service_name", "terraform-testing-service"),
					resource.TestCheckResourceAttr(
						"azure_instance.foo", "location", "West US"),
					resource.TestCheckResourceAttr(
						"azure_instance.foo", "endpoint.2462817782.public_port", "22"),
				),
			},
		},
	})
}
func TestAccStatusCake_withUpdate(t *testing.T) {
	var test statuscake.Test

	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccTestCheckDestroy(&test),
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: testAccTestConfig_basic,
				Check: resource.ComposeTestCheckFunc(
					testAccTestCheckExists("statuscake_test.google", &test),
				),
			},

			resource.TestStep{
				Config: testAccTestConfig_update,
				Check: resource.ComposeTestCheckFunc(
					testAccTestCheckExists("statuscake_test.google", &test),
					resource.TestCheckResourceAttr("statuscake_test.google", "check_rate", "500"),
					resource.TestCheckResourceAttr("statuscake_test.google", "paused", "true"),
				),
			},
		},
	})
}
func TestAccAzureSecurityGroupRuleBasic(t *testing.T) {
	name := "azure_security_group_rule.foo"

	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccCheckAzureSecurityGroupRuleDeleted([]string{testAccSecurityGroupName}),
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: testAccAzureSecurityGroupRuleBasicConfig,
				Check: resource.ComposeTestCheckFunc(
					testAccCheckAzureSecurityGroupRuleExists(name, testAccSecurityGroupName),
					resource.TestCheckResourceAttr(name, "name", "terraform-secgroup-rule"),
					resource.TestCheckResourceAttr(name,
						fmt.Sprintf("security_group_names.%d", schema.HashString(testAccSecurityGroupName)),
						testAccSecurityGroupName),
					resource.TestCheckResourceAttr(name, "type", "Inbound"),
					resource.TestCheckResourceAttr(name, "action", "Deny"),
					resource.TestCheckResourceAttr(name, "priority", "200"),
					resource.TestCheckResourceAttr(name, "source_address_prefix", "100.0.0.0/32"),
					resource.TestCheckResourceAttr(name, "source_port_range", "1000"),
					resource.TestCheckResourceAttr(name, "destination_address_prefix", "10.0.0.0/32"),
					resource.TestCheckResourceAttr(name, "destination_port_range", "1000"),
					resource.TestCheckResourceAttr(name, "protocol", "TCP"),
				),
			},
		},
	})
}
func TestAccVcdSNAT_Basic(t *testing.T) {
	if v := os.Getenv("VCD_EXTERNAL_IP"); v == "" {
		t.Skip("Environment variable VCD_EXTERNAL_IP must be set to run SNAT tests")
		return
	}

	var e govcd.EdgeGateway

	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccCheckVcdSNATDestroy,
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: fmt.Sprintf(testAccCheckVcdSnat_basic, os.Getenv("VCD_EDGE_GATWEWAY"), os.Getenv("VCD_EXTERNAL_IP")),
				Check: resource.ComposeTestCheckFunc(
					testAccCheckVcdSNATExists("vcd_snat.bar", &e),
					resource.TestCheckResourceAttr(
						"vcd_snat.bar", "external_ip", os.Getenv("VCD_EXTERNAL_IP")),
					resource.TestCheckResourceAttr(
						"vcd_snat.bar", "internal_ip", "10.10.102.0/24"),
				),
			},
		},
	})
}
func TestAccDigitalOceanDroplet_Basic(t *testing.T) {
	var droplet godo.Droplet

	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccCheckDigitalOceanDropletDestroy,
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: testAccCheckDigitalOceanDropletConfig_basic,
				Check: resource.ComposeTestCheckFunc(
					testAccCheckDigitalOceanDropletExists("digitalocean_droplet.foobar", &droplet),
					testAccCheckDigitalOceanDropletAttributes(&droplet),
					resource.TestCheckResourceAttr(
						"digitalocean_droplet.foobar", "name", "foo"),
					resource.TestCheckResourceAttr(
						"digitalocean_droplet.foobar", "size", "512mb"),
					resource.TestCheckResourceAttr(
						"digitalocean_droplet.foobar", "image", "centos-5-8-x32"),
					resource.TestCheckResourceAttr(
						"digitalocean_droplet.foobar", "region", "nyc3"),
					resource.TestCheckResourceAttr(
						"digitalocean_droplet.foobar", "user_data", "foobar"),
				),
			},
		},
	})
}
func TestAccAzureRMResourceGroup_withTags(t *testing.T) {
	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testCheckAzureRMResourceGroupDestroy,
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: testAccAzureRMResourceGroup_withTags,
				Check: resource.ComposeTestCheckFunc(
					testCheckAzureRMResourceGroupExists("azurerm_resource_group.test"),
					resource.TestCheckResourceAttr(
						"azurerm_resource_group.test", "tags.#", "2"),
					resource.TestCheckResourceAttr(
						"azurerm_resource_group.test", "tags.environment", "Production"),
					resource.TestCheckResourceAttr(
						"azurerm_resource_group.test", "tags.cost_center", "MSFT"),
				),
			},

			resource.TestStep{
				Config: testAccAzureRMResourceGroup_withTagsUpdated,
				Check: resource.ComposeTestCheckFunc(
					testCheckAzureRMResourceGroupExists("azurerm_resource_group.test"),
					resource.TestCheckResourceAttr(
						"azurerm_resource_group.test", "tags.#", "1"),
					resource.TestCheckResourceAttr(
						"azurerm_resource_group.test", "tags.environment", "staging"),
				),
			},
		},
	})
}
func TestAccDigitalOceanDroplet_Update(t *testing.T) {
	var droplet godo.Droplet

	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccCheckDigitalOceanDropletDestroy,
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: testAccCheckDigitalOceanDropletConfig_basic,
				Check: resource.ComposeTestCheckFunc(
					testAccCheckDigitalOceanDropletExists("digitalocean_droplet.foobar", &droplet),
					testAccCheckDigitalOceanDropletAttributes(&droplet),
				),
			},

			resource.TestStep{
				Config: testAccCheckDigitalOceanDropletConfig_RenameAndResize,
				Check: resource.ComposeTestCheckFunc(
					testAccCheckDigitalOceanDropletExists("digitalocean_droplet.foobar", &droplet),
					testAccCheckDigitalOceanDropletRenamedAndResized(&droplet),
					resource.TestCheckResourceAttr(
						"digitalocean_droplet.foobar", "name", "baz"),
					resource.TestCheckResourceAttr(
						"digitalocean_droplet.foobar", "size", "1gb"),
				),
			},
		},
	})
}
func TestAccAWSRedshiftSecurityGroup_ingressSecurityGroup(t *testing.T) {
	var v redshift.ClusterSecurityGroup

	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccCheckAWSRedshiftSecurityGroupDestroy,
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: testAccAWSRedshiftSecurityGroupConfig_ingressSgId,
				Check: resource.ComposeTestCheckFunc(
					testAccCheckAWSRedshiftSecurityGroupExists("aws_redshift_security_group.bar", &v),
					resource.TestCheckResourceAttr(
						"aws_redshift_security_group.bar", "name", "redshift-sg-terraform"),
					resource.TestCheckResourceAttr(
						"aws_redshift_security_group.bar", "description", "this is a description"),
					resource.TestCheckResourceAttr(
						"aws_redshift_security_group.bar", "ingress.#", "1"),
					resource.TestCheckResourceAttr(
						"aws_redshift_security_group.bar", "ingress.220863.security_group_name", "terraform_redshift_acceptance_test"),
				),
			},
		},
	})
}
func TestAccCloudStackInstance_update(t *testing.T) {
	var instance cloudstack.VirtualMachine

	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccCheckCloudStackInstanceDestroy,
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: testAccCloudStackInstance_basic,
				Check: resource.ComposeTestCheckFunc(
					testAccCheckCloudStackInstanceExists(
						"cloudstack_instance.foobar", &instance),
					testAccCheckCloudStackInstanceAttributes(&instance),
					resource.TestCheckResourceAttr(
						"cloudstack_instance.foobar", "user_data", "0cf3dcdc356ec8369494cb3991985ecd5296cdd5"),
				),
			},

			resource.TestStep{
				Config: testAccCloudStackInstance_renameAndResize,
				Check: resource.ComposeTestCheckFunc(
					testAccCheckCloudStackInstanceExists(
						"cloudstack_instance.foobar", &instance),
					testAccCheckCloudStackInstanceRenamedAndResized(&instance),
					resource.TestCheckResourceAttr(
						"cloudstack_instance.foobar", "display_name", "terraform-updated"),
					resource.TestCheckResourceAttr(
						"cloudstack_instance.foobar", "service_offering", CLOUDSTACK_SERVICE_OFFERING_2),
				),
			},
		},
	})
}
func TestAccVcdNetwork_Basic(t *testing.T) {
	var network govcd.OrgVDCNetwork
	generatedHrefRegexp := regexp.MustCompile("^https://")

	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccCheckVcdNetworkDestroy,
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: fmt.Sprintf(testAccCheckVcdNetwork_basic, os.Getenv("VCD_EDGE_GATWEWAY")),
				Check: resource.ComposeTestCheckFunc(
					testAccCheckVcdNetworkExists("vcd_network.foonet", &network),
					testAccCheckVcdNetworkAttributes(&network),
					resource.TestCheckResourceAttr(
						"vcd_network.foonet", "name", "foonet"),
					resource.TestCheckResourceAttr(
						"vcd_network.foonet", "static_ip_pool.#", "1"),
					resource.TestCheckResourceAttr(
						"vcd_network.foonet", "gateway", "10.10.102.1"),
					resource.TestMatchResourceAttr(
						"vcd_network.foonet", "href", generatedHrefRegexp),
				),
			},
		},
	})
}
func TestAccAWSELBUpdate_Listener(t *testing.T) {
	var conf elb.LoadBalancerDescription

	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccCheckAWSELBDestroy,
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: testAccAWSELBConfig,
				Check: resource.ComposeTestCheckFunc(
					testAccCheckAWSELBExists("aws_elb.bar", &conf),
					testAccCheckAWSELBAttributes(&conf),
					resource.TestCheckResourceAttr(
						"aws_elb.bar", "listener.206423021.instance_port", "8000"),
				),
			},

			resource.TestStep{
				Config: testAccAWSELBConfigListener_update,
				Check: resource.ComposeTestCheckFunc(
					testAccCheckAWSELBExists("aws_elb.bar", &conf),
					resource.TestCheckResourceAttr(
						"aws_elb.bar", "listener.3931999347.instance_port", "8080"),
				),
			},
		},
	})
}
func TestAccCloudStackVPNCustomerGateway_basic(t *testing.T) {
	var vpnCustomerGateway cloudstack.VpnCustomerGateway

	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccCheckCloudStackVPNCustomerGatewayDestroy,
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: testAccCloudStackVPNCustomerGateway_basic,
				Check: resource.ComposeTestCheckFunc(
					testAccCheckCloudStackVPNCustomerGatewayExists(
						"cloudstack_vpn_customer_gateway.foo", &vpnCustomerGateway),
					testAccCheckCloudStackVPNCustomerGatewayAttributes(&vpnCustomerGateway),
					resource.TestCheckResourceAttr(
						"cloudstack_vpn_customer_gateway.foo", "name", "terraform-foo"),
					resource.TestCheckResourceAttr(
						"cloudstack_vpn_customer_gateway.bar", "name", "terraform-bar"),
					resource.TestCheckResourceAttr(
						"cloudstack_vpn_customer_gateway.foo", "ike_policy", "aes256-sha1"),
					resource.TestCheckResourceAttr(
						"cloudstack_vpn_customer_gateway.bar", "esp_policy", "aes256-sha1"),
				),
			},
		},
	})
}
func TestAccStorageBucketUpdate(t *testing.T) {
	bucketName := fmt.Sprintf("tf-test-acl-bucket-%d", acctest.RandInt())

	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccGoogleStorageDestroy,
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: testGoogleStorageBucketsReaderDefaults(bucketName),
				Check: resource.ComposeTestCheckFunc(
					testAccCheckCloudStorageBucketExists(
						"google_storage_bucket.bucket", bucketName),
					resource.TestCheckResourceAttr(
						"google_storage_bucket.bucket", "location", "US"),
					resource.TestCheckResourceAttr(
						"google_storage_bucket.bucket", "force_destroy", "false"),
				),
			},
			resource.TestStep{
				Config: testGoogleStorageBucketsReaderCustomAttributes(bucketName),
				Check: resource.ComposeTestCheckFunc(
					testAccCheckCloudStorageBucketExists(
						"google_storage_bucket.bucket", bucketName),
					resource.TestCheckResourceAttr(
						"google_storage_bucket.bucket", "predefined_acl", "publicReadWrite"),
					resource.TestCheckResourceAttr(
						"google_storage_bucket.bucket", "location", "EU"),
					resource.TestCheckResourceAttr(
						"google_storage_bucket.bucket", "force_destroy", "true"),
				),
			},
		},
	})
}