Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elastic Transcoder imports #6388

Merged
merged 4 commits into from
Nov 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions aws/resource_aws_elastic_transcoder_pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ func resourceAwsElasticTranscoderPipeline() *schema.Resource {
Read: resourceAwsElasticTranscoderPipelineRead,
Update: resourceAwsElasticTranscoderPipelineUpdate,
Delete: resourceAwsElasticTranscoderPipelineDelete,
Importer: &schema.ResourceImporter{
State: schema.ImportStatePassthrough,
},

Schema: map[string]*schema.Schema{
"arn": {
Expand Down
29 changes: 25 additions & 4 deletions aws/resource_aws_elastic_transcoder_pipeline_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func TestAccAWSElasticTranscoderPipeline_basic(t *testing.T) {
CheckDestroy: testAccCheckElasticTranscoderPipelineDestroy,
Steps: []resource.TestStep{
{
Config: awsElasticTranscoderPipelineConfigBasic,
Config: fmt.Sprintf(awsElasticTranscoderPipelineConfigBasic, "basic"),
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSElasticTranscoderPipelineExists("aws_elastictranscoder_pipeline.bar", pipeline),
),
Expand Down Expand Up @@ -229,16 +229,37 @@ func testAccCheckElasticTranscoderPipelineDestroy(s *terraform.State) error {
return nil
}

func TestAccAWSElasticTranscoderPipeline_import(t *testing.T) {
resourceName := "aws_elastictranscoder_pipeline.bar"

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckElasticTranscoderPipelineDestroy,
Steps: []resource.TestStep{
{
Config: fmt.Sprintf(awsElasticTranscoderPipelineConfigBasic, "import"),
},

{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
},
})
}

const awsElasticTranscoderPipelineConfigBasic = `
resource "aws_elastictranscoder_pipeline" "bar" {
input_bucket = "${aws_s3_bucket.test_bucket.bucket}"
output_bucket = "${aws_s3_bucket.test_bucket.bucket}"
name = "aws_elastictranscoder_pipeline_tf_test_"
name = "aws_ets_pipeline_tf_test_%[1]s"
role = "${aws_iam_role.test_role.arn}"
}

resource "aws_iam_role" "test_role" {
name = "aws_elastictranscoder_pipeline_tf_test_role_"
name = "aws_elastictranscoder_pipeline_tf_test_role_%[1]s"

assume_role_policy = <<EOF
{
Expand All @@ -258,7 +279,7 @@ EOF
}

resource "aws_s3_bucket" "test_bucket" {
bucket = "aws-elasticencoder-pipeline-tf-test-bucket"
bucket = "aws-elasticencoder-pipeline-tf-test-bucket-%[1]s"
acl = "private"
}
`
Expand Down
4 changes: 4 additions & 0 deletions aws/resource_aws_elastic_transcoder_preset.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ func resourceAwsElasticTranscoderPreset() *schema.Resource {
Create: resourceAwsElasticTranscoderPresetCreate,
Read: resourceAwsElasticTranscoderPresetRead,
Delete: resourceAwsElasticTranscoderPresetDelete,
Importer: &schema.ResourceImporter{
State: schema.ImportStatePassthrough,
},

Schema: map[string]*schema.Schema{
"arn": {
Expand Down Expand Up @@ -500,6 +503,7 @@ func resourceAwsElasticTranscoderPresetRead(d *schema.ResourceData, meta interfa

d.Set("container", *preset.Container)
d.Set("name", *preset.Name)
d.Set("description", *preset.Description)

if preset.Thumbnails != nil {
err := d.Set("thumbnails", flattenETThumbnails(preset.Thumbnails))
Expand Down
21 changes: 21 additions & 0 deletions aws/resource_aws_elastic_transcoder_preset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,27 @@ import (
"github.com/hashicorp/terraform/terraform"
)

func TestAccAWSElasticTranscoderPreset_import(t *testing.T) {
resourceName := "aws_elastictranscoder_preset.bar"

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckElasticTranscoderPresetDestroy,
Steps: []resource.TestStep{
{
Config: awsElasticTranscoderPresetConfig,
},

{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
},
})
}

func TestAccAWSElasticTranscoderPreset_basic(t *testing.T) {
preset := &elastictranscoder.Preset{}
name := "aws_elastictranscoder_preset.bar"
Expand Down
8 changes: 8 additions & 0 deletions website/docs/r/elastic_transcoder_pipeline.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,11 @@ The `thumbnail_config_permissions` object supports the following:
* `access` - The permission that you want to give to the AWS user that you specified in `thumbnail_config_permissions.grantee`.
* `grantee` - The AWS user or group that you want to have access to thumbnail files.
* `grantee_type` - Specify the type of value that appears in the `thumbnail_config_permissions.grantee` object.

## Import

Elastic Transcoder pipelines can be imported using the `id`, e.g.

```
$ terraform import aws_elastic_transcoder_pipeline.basic_pipeline 1407981661351-cttk8b
```
8 changes: 8 additions & 0 deletions website/docs/r/elastic_transcoder_preset.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,11 @@ The `video_codec_options` map supports the following:
* `ColorSpaceConversion` - The color space conversion Elastic Transcoder applies to the output video. Valid values are `None`, `Bt709toBt601`, `Bt601toBt709`, and `Auto`. (Optional, H.264/MPEG2 Only)
* `ChromaSubsampling` - The sampling pattern for the chroma (color) channels of the output video. Valid values are `yuv420p` and `yuv422p`.
* `LoopCount` - The number of times you want the output gif to loop (Gif only)

## Import

Elastic Transcoder presets can be imported using the `id`, e.g.

```
$ terraform import aws_elastic_transcoder_preset.basic_preset 1407981661351-cttk8b
```