func TestAccAWSSecurityGroup_DefaultEgress(t *testing.T) { // VPC resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ resource.TestStep{ Config: testAccAWSSecurityGroupConfigDefaultEgress, Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityGroupExistsWithoutDefault("aws_security_group.worker"), ), }, }, }) // Classic var group ec2.SecurityGroup resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ resource.TestStep{ Config: testAccAWSSecurityGroupConfigClassic, Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityGroupExists("aws_security_group.web", &group), ), }, }, }) }
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"), ), }, }, }) }
// Regression for https://github.com/hashicorp/terraform/issues/2427 func TestAccAWSEcsServiceWithRenamedCluster(t *testing.T) { originalRegexp := regexp.MustCompile( "^arn:aws:ecs:[^:]+:[0-9]+:cluster/terraformecstest3$") modifiedRegexp := regexp.MustCompile( "^arn:aws:ecs:[^:]+:[0-9]+:cluster/terraformecstest3modified$") resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSEcsServiceDestroy, Steps: []resource.TestStep{ resource.TestStep{ Config: testAccAWSEcsServiceWithRenamedCluster, Check: resource.ComposeTestCheckFunc( testAccCheckAWSEcsServiceExists("aws_ecs_service.ghost"), resource.TestMatchResourceAttr( "aws_ecs_service.ghost", "cluster", originalRegexp), ), }, resource.TestStep{ Config: testAccAWSEcsServiceWithRenamedClusterModified, Check: resource.ComposeTestCheckFunc( testAccCheckAWSEcsServiceExists("aws_ecs_service.ghost"), resource.TestMatchResourceAttr( "aws_ecs_service.ghost", "cluster", modifiedRegexp), ), }, }, }) }
func TestAccFWRuleV1_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckFWRuleV1Destroy, Steps: []resource.TestStep{ resource.TestStep{ Config: testFirewallRuleMinimalConfig, Check: resource.ComposeTestCheckFunc( testAccCheckFWRuleV1Exists( "openstack_fw_rule_v1.accept_test_minimal", &rules.Rule{ Protocol: "udp", Action: "deny", IPVersion: 4, Enabled: true, }), ), }, resource.TestStep{ Config: testFirewallRuleConfig, Check: resource.ComposeTestCheckFunc( testAccCheckFWRuleV1Exists( "openstack_fw_rule_v1.accept_test", &rules.Rule{ Name: "accept_test", Protocol: "udp", Action: "deny", Description: "Terraform accept test", IPVersion: 4, SourceIPAddress: "1.2.3.4", DestinationIPAddress: "4.3.2.0/24", SourcePort: "444", DestinationPort: "555", Enabled: true, }), ), }, resource.TestStep{ Config: testFirewallRuleUpdateAllFieldsConfig, Check: resource.ComposeTestCheckFunc( testAccCheckFWRuleV1Exists( "openstack_fw_rule_v1.accept_test", &rules.Rule{ Name: "accept_test_updated_2", Protocol: "tcp", Action: "allow", Description: "Terraform accept test updated", IPVersion: 4, SourceIPAddress: "1.2.3.0/24", DestinationIPAddress: "4.3.2.8", SourcePort: "666", DestinationPort: "777", Enabled: false, }), ), }, }, }) }
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 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 TestAccAWSEFSFileSystem(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckEfsFileSystemDestroy, Steps: []resource.TestStep{ resource.TestStep{ Config: testAccAWSEFSFileSystemConfig, Check: resource.ComposeTestCheckFunc( testAccCheckEfsFileSystem( "aws_efs_file_system.foo", ), ), }, resource.TestStep{ Config: testAccAWSEFSFileSystemConfigWithTags, Check: resource.ComposeTestCheckFunc( testAccCheckEfsFileSystem( "aws_efs_file_system.foo-with-tags", ), testAccCheckEfsFileSystemTags( "aws_efs_file_system.foo-with-tags", map[string]string{ "Name": "foo-efs", "Another": "tag", }, ), ), }, }, }) }
func TestAccAzureSqlDatabaseServerFirewallRuleAdvanced(t *testing.T) { name1 := "azure_sql_database_server_firewall_rule.foo" name2 := "azure_sql_database_server_firewall_rule.bar" resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccAzureDatabaseServerFirewallRuleDeleted(testAccAzureSqlServerNames), Steps: []resource.TestStep{ resource.TestStep{ Config: testAccAzureDatabaseServerFirewallRuleAdvancedConfig, Check: resource.ComposeTestCheckFunc( testAccAzureSqlDatabaseServerGetNames, testAccAzureSqlDatabaseServersNumber(2), //testAccAzureDatabaseServerFirewallRuleExists(name1, testAccAzureSqlServerNames), resource.TestCheckResourceAttr(name1, "name", "terraform-testing-rule1"), resource.TestCheckResourceAttr(name1, "start_ip", "10.0.0.0"), resource.TestCheckResourceAttr(name1, "end_ip", "10.0.0.255"), //testAccAzureDatabaseServerFirewallRuleExists(name2, testAccAzureSqlServerNames), resource.TestCheckResourceAttr(name2, "name", "terraform-testing-rule2"), resource.TestCheckResourceAttr(name2, "start_ip", "200.0.0.0"), resource.TestCheckResourceAttr(name2, "end_ip", "200.255.255.255"), ), }, }, }) }
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 TestAccDMERecordCName(t *testing.T) { var record dnsmadeeasy.Record domainid := os.Getenv("DME_DOMAINID") resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckDMERecordDestroy, Steps: []resource.TestStep{ resource.TestStep{ Config: fmt.Sprintf(testDMERecordConfigCName, domainid), Check: resource.ComposeTestCheckFunc( testAccCheckDMERecordExists("dme_record.test", &record), resource.TestCheckResourceAttr( "dme_record.test", "domainid", domainid), resource.TestCheckResourceAttr( "dme_record.test", "name", "testcname"), resource.TestCheckResourceAttr( "dme_record.test", "type", "CNAME"), resource.TestCheckResourceAttr( "dme_record.test", "value", "foo"), resource.TestCheckResourceAttr( "dme_record.test", "ttl", "2000"), resource.TestCheckResourceAttr( "dme_record.test", "gtdLocation", "DEFAULT"), ), }, }, }) }
func TestAccAWSRoute53Zone_private_region(t *testing.T) { var zone route53.GetHostedZoneOutput // record the initialized providers so that we can use them to // check for the instances in each region var providers []*schema.Provider providerFactories := map[string]terraform.ResourceProviderFactory{ "aws": func() (terraform.ResourceProvider, error) { p := Provider() providers = append(providers, p.(*schema.Provider)) return p, nil }, } resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, ProviderFactories: providerFactories, CheckDestroy: testAccCheckRoute53ZoneDestroyWithProviders(&providers), Steps: []resource.TestStep{ resource.TestStep{ Config: testAccRoute53PrivateZoneRegionConfig, Check: resource.ComposeTestCheckFunc( testAccCheckRoute53ZoneExistsWithProviders("aws_route53_zone.main", &zone, &providers), testAccCheckRoute53ZoneAssociatesWithVpc("aws_vpc.main", &zone), ), }, }, }) }
func TestAccComputeFirewall_update(t *testing.T) { var firewall compute.Firewall networkName := fmt.Sprintf("firewall-test-%s", acctest.RandString(10)) firewallName := fmt.Sprintf("firewall-test-%s", acctest.RandString(10)) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckComputeFirewallDestroy, Steps: []resource.TestStep{ resource.TestStep{ Config: testAccComputeFirewall_basic(networkName, firewallName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeFirewallExists( "google_compute_firewall.foobar", &firewall), ), }, resource.TestStep{ Config: testAccComputeFirewall_update(networkName, firewallName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeFirewallExists( "google_compute_firewall.foobar", &firewall), testAccCheckComputeFirewallPorts( &firewall, "80-255"), ), }, }, }) }
func TestAccProject_basic(t *testing.T) { var project rundeck.Project resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccProjectCheckDestroy(&project), Steps: []resource.TestStep{ resource.TestStep{ Config: testAccProjectConfig_basic, Check: resource.ComposeTestCheckFunc( testAccProjectCheckExists("rundeck_project.main", &project), func(s *terraform.State) error { if expected := "terraform-acc-test-basic"; project.Name != expected { return fmt.Errorf("wrong name; expected %v, got %v", expected, project.Name) } if expected := "baz"; project.Config["foo.bar"] != expected { return fmt.Errorf("wrong foo.bar config; expected %v, got %v", expected, project.Config["foo.bar"]) } if expected := "file"; project.Config["resources.source.1.type"] != expected { return fmt.Errorf("wrong resources.source.1.type config; expected %v, got %v", expected, project.Config["resources.source.1.type"]) } return nil }, ), }, }, }) }
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 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 TestAccComputeV2Instance_volumeAttach(t *testing.T) { var instance servers.Server var volume volumes.Volume var testAccComputeV2Instance_volumeAttach = fmt.Sprintf(` resource "openstack_blockstorage_volume_v1" "myvol" { name = "myvol" size = 1 } resource "openstack_compute_instance_v2" "foo" { name = "terraform-test" security_groups = ["default"] volume { volume_id = "${openstack_blockstorage_volume_v1.myvol.id}" } }`) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckComputeV2InstanceDestroy, Steps: []resource.TestStep{ resource.TestStep{ Config: testAccComputeV2Instance_volumeAttach, Check: resource.ComposeTestCheckFunc( testAccCheckBlockStorageV1VolumeExists(t, "openstack_blockstorage_volume_v1.myvol", &volume), testAccCheckComputeV2InstanceExists(t, "openstack_compute_instance_v2.foo", &instance), testAccCheckComputeV2InstanceVolumeAttachment(&instance, &volume), ), }, }, }) }
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 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 TestAccComputeV2FloatingIP_attach(t *testing.T) { var instance servers.Server var fip floatingip.FloatingIP var testAccComputeV2FloatingIP_attach = fmt.Sprintf(` resource "openstack_compute_floatingip_v2" "myip" { } resource "openstack_compute_instance_v2" "foo" { name = "terraform-test" security_groups = ["default"] floating_ip = "${openstack_compute_floatingip_v2.myip.address}" network { uuid = "%s" } }`, os.Getenv("OS_NETWORK_ID")) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckComputeV2FloatingIPDestroy, Steps: []resource.TestStep{ resource.TestStep{ Config: testAccComputeV2FloatingIP_attach, Check: resource.ComposeTestCheckFunc( testAccCheckComputeV2FloatingIPExists(t, "openstack_compute_floatingip_v2.myip", &fip), testAccCheckComputeV2InstanceExists(t, "openstack_compute_instance_v2.foo", &instance), testAccCheckComputeV2InstanceFloatingIPAttach(&instance, &fip), ), }, }, }) }
func TestAccAWSVpnConnection_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccAwsVpnConnectionDestroy, Steps: []resource.TestStep{ resource.TestStep{ Config: testAccAwsVpnConnectionConfig, Check: resource.ComposeTestCheckFunc( testAccAwsVpnConnection( "aws_vpc.vpc", "aws_vpn_gateway.vpn_gateway", "aws_customer_gateway.customer_gateway", "aws_vpn_connection.foo", ), ), }, resource.TestStep{ Config: testAccAwsVpnConnectionConfigUpdate, Check: resource.ComposeTestCheckFunc( testAccAwsVpnConnection( "aws_vpc.vpc", "aws_vpn_gateway.vpn_gateway", "aws_customer_gateway.customer_gateway", "aws_vpn_connection.foo", ), ), }, }, }) }
func TestAccAWSIAMUserPolicy_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckIAMUserPolicyDestroy, Steps: []resource.TestStep{ resource.TestStep{ Config: testAccIAMUserPolicyConfig, Check: resource.ComposeTestCheckFunc( testAccCheckIAMUserPolicy( "aws_iam_user.user", "aws_iam_user_policy.foo", ), ), }, resource.TestStep{ Config: testAccIAMUserPolicyConfigUpdate, Check: resource.ComposeTestCheckFunc( testAccCheckIAMUserPolicy( "aws_iam_user.user", "aws_iam_user_policy.bar", ), ), }, }, }) }
func TestAccAutoscaler_update(t *testing.T) { var ascaler compute.Autoscaler resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckAutoscalerDestroy, Steps: []resource.TestStep{ resource.TestStep{ Config: testAccAutoscaler_basic, Check: resource.ComposeTestCheckFunc( testAccCheckAutoscalerExists( "google_compute_autoscaler.foobar", &ascaler), ), }, resource.TestStep{ Config: testAccAutoscaler_update, Check: resource.ComposeTestCheckFunc( testAccCheckAutoscalerExists( "google_compute_autoscaler.foobar", &ascaler), testAccCheckAutoscalerUpdated( "google_compute_autoscaler.foobar", 10), ), }, }, }) }
func TestAccHerokuApp_Organization(t *testing.T) { var app heroku.OrganizationApp appName := fmt.Sprintf("tftest-%s", acctest.RandString(10)) org := os.Getenv("HEROKU_ORGANIZATION") resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) if org == "" { t.Skip("HEROKU_ORGANIZATION is not set; skipping test.") } }, Providers: testAccProviders, CheckDestroy: testAccCheckHerokuAppDestroy, Steps: []resource.TestStep{ resource.TestStep{ Config: testAccCheckHerokuAppConfig_organization(appName, org), Check: resource.ComposeTestCheckFunc( testAccCheckHerokuAppExistsOrg("heroku_app.foobar", &app), testAccCheckHerokuAppAttributesOrg(&app, appName, org), ), }, }, }) }
func TestAccCloudStackTemplate_update(t *testing.T) { var template cloudstack.Template resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckCloudStackTemplateDestroy, Steps: []resource.TestStep{ resource.TestStep{ Config: testAccCloudStackTemplate_basic, Check: resource.ComposeTestCheckFunc( testAccCheckCloudStackTemplateExists("cloudstack_template.foo", &template), testAccCheckCloudStackTemplateBasicAttributes(&template), ), }, resource.TestStep{ Config: testAccCloudStackTemplate_update, Check: resource.ComposeTestCheckFunc( testAccCheckCloudStackTemplateExists( "cloudstack_template.foo", &template), testAccCheckCloudStackTemplateUpdatedAttributes(&template), resource.TestCheckResourceAttr( "cloudstack_template.foo", "display_text", "terraform-updated"), ), }, }, }) }
func TestAccInstanceGroupManager_basic(t *testing.T) { var manager compute.InstanceGroupManager template := fmt.Sprintf("igm-test-%s", acctest.RandString(10)) target := fmt.Sprintf("igm-test-%s", acctest.RandString(10)) igm1 := fmt.Sprintf("igm-test-%s", acctest.RandString(10)) igm2 := fmt.Sprintf("igm-test-%s", acctest.RandString(10)) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckInstanceGroupManagerDestroy, Steps: []resource.TestStep{ resource.TestStep{ Config: testAccInstanceGroupManager_basic(template, target, igm1, igm2), Check: resource.ComposeTestCheckFunc( testAccCheckInstanceGroupManagerExists( "google_compute_instance_group_manager.igm-basic", &manager), testAccCheckInstanceGroupManagerExists( "google_compute_instance_group_manager.igm-no-tp", &manager), ), }, }, }) }
func TestAccComputeV2Instance_basic(t *testing.T) { var instance servers.Server var testAccComputeV2Instance_basic = fmt.Sprintf(` resource "openstack_compute_instance_v2" "foo" { name = "terraform-test" security_groups = ["default"] network { uuid = "%s" } metadata { foo = "bar" } }`, os.Getenv("OS_NETWORK_ID")) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckComputeV2InstanceDestroy, Steps: []resource.TestStep{ resource.TestStep{ Config: testAccComputeV2Instance_basic, Check: resource.ComposeTestCheckFunc( testAccCheckComputeV2InstanceExists(t, "openstack_compute_instance_v2.foo", &instance), testAccCheckComputeV2InstanceMetadata(&instance, "foo", "bar"), ), }, }, }) }
func TestAccAWSAppCookieStickinessPolicy_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckAppCookieStickinessPolicyDestroy, Steps: []resource.TestStep{ resource.TestStep{ Config: testAccAppCookieStickinessPolicyConfig, Check: resource.ComposeTestCheckFunc( testAccCheckAppCookieStickinessPolicy( "aws_elb.lb", "aws_app_cookie_stickiness_policy.foo", ), ), }, resource.TestStep{ Config: testAccAppCookieStickinessPolicyConfigUpdate, Check: resource.ComposeTestCheckFunc( testAccCheckAppCookieStickinessPolicy( "aws_elb.lb", "aws_app_cookie_stickiness_policy.foo", ), ), }, }, }) }
func TestAccComputeV2Instance_bootFromVolumeImage(t *testing.T) { var instance servers.Server var testAccComputeV2Instance_bootFromVolumeImage = fmt.Sprintf(` resource "openstack_compute_instance_v2" "foo" { name = "terraform-test" security_groups = ["default"] block_device { uuid = "%s" source_type = "image" volume_size = 5 boot_index = 0 destination_type = "volume" delete_on_termination = true } }`, os.Getenv("OS_IMAGE_ID")) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckComputeV2InstanceDestroy, Steps: []resource.TestStep{ resource.TestStep{ Config: testAccComputeV2Instance_bootFromVolumeImage, Check: resource.ComposeTestCheckFunc( testAccCheckComputeV2InstanceExists(t, "openstack_compute_instance_v2.foo", &instance), testAccCheckComputeV2InstanceBootVolumeAttachment(&instance), ), }, }, }) }
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"), ), }, }, }) }
// TODO: verify the personality really exists on the instance. func TestAccComputeV2Instance_personality(t *testing.T) { var instance servers.Server var testAccComputeV2Instance_personality = fmt.Sprintf(` resource "openstack_compute_instance_v2" "foo" { name = "terraform-test" security_groups = ["default"] personality { file = "/tmp/foobar.txt" content = "happy" } personality { file = "/tmp/barfoo.txt" content = "angry" } }`) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckComputeV2InstanceDestroy, Steps: []resource.TestStep{ resource.TestStep{ Config: testAccComputeV2Instance_personality, Check: resource.ComposeTestCheckFunc( testAccCheckComputeV2InstanceExists(t, "openstack_compute_instance_v2.foo", &instance), ), }, }, }) }