github.com/minamijoyo/terraform@v0.7.8-0.20161029001309-18b3736ba44b/builtin/providers/aws/import_aws_lambda_function_test.go (about)

     1  package aws
     2  
     3  import (
     4  	"fmt"
     5  	"testing"
     6  
     7  	"github.com/hashicorp/terraform/helper/acctest"
     8  	"github.com/hashicorp/terraform/helper/resource"
     9  )
    10  
    11  func TestAccAWSLambdaFunction_importLocalFile(t *testing.T) {
    12  	resourceName := "aws_lambda_function.lambda_function_test"
    13  
    14  	rName := fmt.Sprintf("tf_test_%s", acctest.RandString(5))
    15  
    16  	resource.Test(t, resource.TestCase{
    17  		PreCheck:     func() { testAccPreCheck(t) },
    18  		Providers:    testAccProviders,
    19  		CheckDestroy: testAccCheckLambdaFunctionDestroy,
    20  		Steps: []resource.TestStep{
    21  			resource.TestStep{
    22  				Config: testAccAWSLambdaConfigBasic(rName),
    23  			},
    24  
    25  			resource.TestStep{
    26  				ResourceName:            resourceName,
    27  				ImportState:             true,
    28  				ImportStateVerify:       true,
    29  				ImportStateVerifyIgnore: []string{"filename", "publish"},
    30  			},
    31  		},
    32  	})
    33  }
    34  
    35  func TestAccAWSLambdaFunction_importLocalFile_VPC(t *testing.T) {
    36  	resourceName := "aws_lambda_function.lambda_function_test"
    37  
    38  	rName := fmt.Sprintf("tf_test_%s", acctest.RandString(5))
    39  
    40  	resource.Test(t, resource.TestCase{
    41  		PreCheck:     func() { testAccPreCheck(t) },
    42  		Providers:    testAccProviders,
    43  		CheckDestroy: testAccCheckLambdaFunctionDestroy,
    44  		Steps: []resource.TestStep{
    45  			resource.TestStep{
    46  				Config: testAccAWSLambdaConfigWithVPC(rName),
    47  			},
    48  
    49  			resource.TestStep{
    50  				ResourceName:            resourceName,
    51  				ImportState:             true,
    52  				ImportStateVerify:       true,
    53  				ImportStateVerifyIgnore: []string{"filename", "publish"},
    54  			},
    55  		},
    56  	})
    57  }
    58  
    59  func TestAccAWSLambdaFunction_importS3(t *testing.T) {
    60  	resourceName := "aws_lambda_function.lambda_function_s3test"
    61  
    62  	rName := fmt.Sprintf("tf_test_%s", acctest.RandString(5))
    63  
    64  	resource.Test(t, resource.TestCase{
    65  		PreCheck:     func() { testAccPreCheck(t) },
    66  		Providers:    testAccProviders,
    67  		CheckDestroy: testAccCheckLambdaFunctionDestroy,
    68  		Steps: []resource.TestStep{
    69  			resource.TestStep{
    70  				Config: testAccAWSLambdaConfigS3(rName),
    71  			},
    72  
    73  			resource.TestStep{
    74  				ResourceName:            resourceName,
    75  				ImportState:             true,
    76  				ImportStateVerify:       true,
    77  				ImportStateVerifyIgnore: []string{"s3_bucket", "s3_key", "publish"},
    78  			},
    79  		},
    80  	})
    81  }