From d114be992384849d82459ec720d3a7dec9171688 Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Mon, 11 Mar 2024 14:08:18 -0500 Subject: [PATCH 1/5] aws_medialive_input: add datasource --- .../service/medialive/input_data_source.go | 170 ++++++++++++++++++ .../medialive/input_data_source_test.go | 141 +++++++++++++++ .../service/medialive/service_package_gen.go | 7 +- website/docs/d/medialive_input.html.markdown | 37 ++++ 4 files changed, 354 insertions(+), 1 deletion(-) create mode 100644 internal/service/medialive/input_data_source.go create mode 100644 internal/service/medialive/input_data_source_test.go create mode 100644 website/docs/d/medialive_input.html.markdown diff --git a/internal/service/medialive/input_data_source.go b/internal/service/medialive/input_data_source.go new file mode 100644 index 00000000000..b11152c3b79 --- /dev/null +++ b/internal/service/medialive/input_data_source.go @@ -0,0 +1,170 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package medialive + +import ( + "context" + + awstypes "github.com/aws/aws-sdk-go-v2/service/medialive/types" + "github.com/hashicorp/terraform-plugin-framework/datasource" + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-provider-aws/internal/create" + "github.com/hashicorp/terraform-provider-aws/internal/framework" + fwflex "github.com/hashicorp/terraform-provider-aws/internal/framework/flex" + fwtypes "github.com/hashicorp/terraform-provider-aws/internal/framework/types" + "github.com/hashicorp/terraform-provider-aws/internal/tags" + "github.com/hashicorp/terraform-provider-aws/names" +) + +// @FrameworkDataSource(name="Input") +func newDataSourceInput(context.Context) (datasource.DataSourceWithConfigure, error) { + return &dataSourceInput{}, nil +} + +const ( + DSNameInput = "Input Data Source" +) + +type dataSourceInput struct { + framework.DataSourceWithConfigure +} + +func (d *dataSourceInput) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { // nosemgrep:ci.meta-in-func-name + resp.TypeName = "aws_medialive_input" +} + +func (d *dataSourceInput) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { + resp.Schema = schema.Schema{ + Attributes: map[string]schema.Attribute{ + "arn": framework.ARNAttributeComputedOnly(), + "attached_channels": schema.ListAttribute{ + CustomType: fwtypes.ListOfStringType, + Computed: true, + }, + "destinations": schema.ListAttribute{ + CustomType: fwtypes.NewListNestedObjectTypeOf[dsDestination](ctx), + Computed: true, + }, + "id": schema.StringAttribute{ + Required: true, + }, + "input_class": schema.StringAttribute{ + CustomType: fwtypes.StringEnumType[awstypes.InputClass](), + Computed: true, + }, + "input_devices": schema.ListAttribute{ + CustomType: fwtypes.NewListNestedObjectTypeOf[dsInputDevice](ctx), + Computed: true, + }, + "input_partner_ids": schema.ListAttribute{ + CustomType: fwtypes.ListOfStringType, + Computed: true, + }, + "input_source_type": schema.StringAttribute{ + CustomType: fwtypes.StringEnumType[awstypes.InputSourceType](), + Computed: true, + }, + "media_connect_flows": schema.ListAttribute{ + CustomType: fwtypes.NewListNestedObjectTypeOf[dsMediaConnectFlow](ctx), + Computed: true, + }, + "name": schema.StringAttribute{ + Computed: true, + }, + "role_arn": schema.StringAttribute{ + Computed: true, + }, + "security_groups": schema.ListAttribute{ + CustomType: fwtypes.ListOfStringType, + Computed: true, + }, + "sources": schema.ListAttribute{ + CustomType: fwtypes.NewListNestedObjectTypeOf[dsInputSource](ctx), + Computed: true, + }, + "state": schema.StringAttribute{ + CustomType: fwtypes.StringEnumType[awstypes.InputState](), + Computed: true, + }, + names.AttrTags: tags.TagsAttributeComputedOnly(), + "type": schema.StringAttribute{ + CustomType: fwtypes.StringEnumType[awstypes.InputType](), + Computed: true, + }, + }, + } +} + +func (d *dataSourceInput) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + conn := d.Meta().MediaLiveClient(ctx) + + var data dataSourceInputData + resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) + if resp.Diagnostics.HasError() { + return + } + + out, err := FindInputByID(ctx, conn, data.ID.ValueString()) + if err != nil { + resp.Diagnostics.AddError( + create.ProblemStandardMessage(names.MediaLive, create.ErrActionReading, DSNameInput, data.ID.String(), err), + err.Error(), + ) + return + } + + resp.Diagnostics.Append(fwflex.Flatten(ctx, out, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) +} + +type dataSourceInputData struct { + ARN types.String `tfsdk:"arn"` + AttachedChannels fwtypes.ListValueOf[types.String] `tfsdk:"attached_channels"` + Destinations fwtypes.ListNestedObjectValueOf[dsDestination] `tfsdk:"destinations"` + ID types.String `tfsdk:"id"` + InputClass fwtypes.StringEnum[awstypes.InputClass] `tfsdk:"input_class"` + InputDevices fwtypes.ListNestedObjectValueOf[dsInputDevice] `tfsdk:"input_devices"` + InputPartnerIDs fwtypes.ListValueOf[types.String] `tfsdk:"input_partner_ids"` + InputSourceType fwtypes.StringEnum[awstypes.InputSourceType] `tfsdk:"input_source_type"` + MediaConnectFlows fwtypes.ListNestedObjectValueOf[dsMediaConnectFlow] `tfsdk:"media_connect_flows"` + Name types.String `tfsdk:"name"` + RoleARN types.String `tfsdk:"role_arn"` + SecurityGroups fwtypes.ListValueOf[types.String] `tfsdk:"security_groups"` + Sources fwtypes.ListNestedObjectValueOf[dsInputSource] `tfsdk:"sources"` + State fwtypes.StringEnum[awstypes.InputState] `tfsdk:"state"` + Tags types.Map `tfsdk:"tags"` + Type fwtypes.StringEnum[awstypes.InputType] `tfsdk:"type"` +} + +type dsDestination struct { + IP types.String `tfsdk:"ip"` + Port types.String `tfsdk:"port"` + URL types.String `tfsdk:"url"` + VPC fwtypes.ListNestedObjectValueOf[dsVPC] `tfsdk:"vpc"` +} + +type dsVPC struct { + AvailabilityZone types.String `tfsdk:"availability_zone"` + NetworkInterfaceID types.String `tfsdk:"network_interface_id"` +} + +type dsInputDevice struct { + ID types.String `tfsdk:"id"` +} + +type dsMediaConnectFlow struct { + FlowARN types.String `tfsdk:"flow_arn"` +} + +type dsInputSource struct { + PasswordParam types.String `tfsdk:"password_param"` + URL types.String `tfsdk:"url"` + Username types.String `tfsdk:"username"` +} diff --git a/internal/service/medialive/input_data_source_test.go b/internal/service/medialive/input_data_source_test.go new file mode 100644 index 00000000000..4575d21aa72 --- /dev/null +++ b/internal/service/medialive/input_data_source_test.go @@ -0,0 +1,141 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package medialive_test + +import ( + "fmt" + "strings" + "testing" + + "github.com/YakDriver/regexache" + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/service/medialive" + "github.com/aws/aws-sdk-go-v2/service/medialive/types" + "github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2/tfawserr" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" + "github.com/hashicorp/terraform-provider-aws/internal/acctest" + "github.com/hashicorp/terraform-provider-aws/internal/conns" + "github.com/hashicorp/terraform-provider-aws/internal/create" + tfmedialive "github.com/hashicorp/terraform-provider-aws/internal/service/medialive" + "github.com/hashicorp/terraform-provider-aws/names" +) + +func TestInputExampleUnitTest(t *testing.T) { + t.Parallel() + + testCases := []struct { + TestName string + Input string + Expected string + Error bool + }{ + { + TestName: "empty", + Input: "", + Expected: "", + Error: true, + }, + { + TestName: "descriptive name", + Input: "some input", + Expected: "some output", + Error: false, + }, + { + TestName: "another descriptive name", + Input: "more input", + Expected: "more output", + Error: false, + }, + } + + for _, testCase := range testCases { + testCase := testCase + t.Run(testCase.TestName, func(t *testing.T) { + t.Parallel() + got, err := tfmedialive.FunctionFromDataSource(testCase.Input) + + if err != nil && !testCase.Error { + t.Errorf("got error (%s), expected no error", err) + } + + if err == nil && testCase.Error { + t.Errorf("got (%s) and no error, expected error", got) + } + + if got != testCase.Expected { + t.Errorf("got %s, expected %s", got, testCase.Expected) + } + }) + } +} + +func TestAccMediaLiveInputDataSource_basic(t *testing.T) { + ctx := acctest.Context(t) + if testing.Short() { + t.Skip("skipping long-running test in short mode") + } + + var input medialive.DescribeInputResponse + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + dataSourceName := "data.aws_medialive_input.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { + acctest.PreCheck(ctx, t) + acctest.PreCheckPartitionHasService(t, names.MediaLiveEndpointID) + testAccPreCheck(ctx, t) + }, + ErrorCheck: acctest.ErrorCheck(t, names.MediaLiveEndpointID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckInputDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccInputDataSourceConfig_basic(rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckInputExists(ctx, dataSourceName, &input), + resource.TestCheckResourceAttr(dataSourceName, "auto_minor_version_upgrade", "false"), + resource.TestCheckResourceAttrSet(dataSourceName, "maintenance_window_start_time.0.day_of_week"), + resource.TestCheckTypeSetElemNestedAttrs(dataSourceName, "user.*", map[string]string{ + "console_access": "false", + "groups.#": "0", + "username": "Test", + "password": "TestTest1234", + }), + acctest.MatchResourceAttrRegionalARN(dataSourceName, "arn", "medialive", regexache.MustCompile(`input:+.`)), + ), + }, + }, + }) +} + +func testAccInputDataSourceConfig_basic(rName, version string) string { + return fmt.Sprintf(` +data "aws_security_group" "test" { + name = %[1]q +} + +data "aws_medialive_input" "test" { + input_name = %[1]q + engine_type = "ActiveMediaLive" + engine_version = %[2]q + host_instance_type = "medialive.t2.micro" + security_groups = [aws_security_group.test.id] + authentication_strategy = "simple" + storage_type = "efs" + + logs { + general = true + } + + user { + username = "Test" + password = "TestTest1234" + } +} +`, rName, version) +} diff --git a/internal/service/medialive/service_package_gen.go b/internal/service/medialive/service_package_gen.go index 8500cab3d1b..3c6861fc74f 100644 --- a/internal/service/medialive/service_package_gen.go +++ b/internal/service/medialive/service_package_gen.go @@ -15,7 +15,12 @@ import ( type servicePackage struct{} func (p *servicePackage) FrameworkDataSources(ctx context.Context) []*types.ServicePackageFrameworkDataSource { - return []*types.ServicePackageFrameworkDataSource{} + return []*types.ServicePackageFrameworkDataSource{ + { + Factory: newDataSourceInput, + Name: "Input", + }, + } } func (p *servicePackage) FrameworkResources(ctx context.Context) []*types.ServicePackageFrameworkResource { diff --git a/website/docs/d/medialive_input.html.markdown b/website/docs/d/medialive_input.html.markdown new file mode 100644 index 00000000000..fde18238879 --- /dev/null +++ b/website/docs/d/medialive_input.html.markdown @@ -0,0 +1,37 @@ +--- +subcategory: "Elemental MediaLive" +layout: "aws" +page_title: "AWS: aws_medialive_input" +description: |- + Terraform data source for managing an AWS Elemental MediaLive Input. +--- + +# Data Source: aws_medialive_input + +Terraform data source for managing an AWS Elemental MediaLive Input. + +## Example Usage + +### Basic Usage + +```terraform +data "aws_medialive_input" "example" { +} +``` + +## Argument Reference + +The following arguments are required: + +* `example_arg` - (Required) Concise argument description. Do not begin the description with "An", "The", "Defines", "Indicates", or "Specifies," as these are verbose. In other words, "Indicates the amount of storage," can be rewritten as "Amount of storage," without losing any information. + +The following arguments are optional: + +* `optional_arg` - (Optional) Concise argument description. Do not begin the description with "An", "The", "Defines", "Indicates", or "Specifies," as these are verbose. In other words, "Indicates the amount of storage," can be rewritten as "Amount of storage," without losing any information. + +## Attribute Reference + +This data source exports the following attributes in addition to the arguments above: + +* `arn` - ARN of the Input. Do not begin the description with "An", "The", "Defines", "Indicates", or "Specifies," as these are verbose. In other words, "Indicates the amount of storage," can be rewritten as "Amount of storage," without losing any information. +* `example_attribute` - Concise description. Do not begin the description with "An", "The", "Defines", "Indicates", or "Specifies," as these are verbose. In other words, "Indicates the amount of storage," can be rewritten as "Amount of storage," without losing any information. \ No newline at end of file From 909984cd26ac363adf6664db9ee7b87c5a3525d2 Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Mon, 11 Mar 2024 15:52:55 -0500 Subject: [PATCH 2/5] aws_medialive_input: add datasource documentation --- .../service/medialive/input_data_source.go | 4 +- .../medialive/input_data_source_test.go | 114 ++++-------------- website/docs/d/medialive_input.html.markdown | 24 ++-- 3 files changed, 43 insertions(+), 99 deletions(-) diff --git a/internal/service/medialive/input_data_source.go b/internal/service/medialive/input_data_source.go index b11152c3b79..8efdf09edf0 100644 --- a/internal/service/medialive/input_data_source.go +++ b/internal/service/medialive/input_data_source.go @@ -19,7 +19,7 @@ import ( ) // @FrameworkDataSource(name="Input") -func newDataSourceInput(context.Context) (datasource.DataSourceWithConfigure, error) { +func newDataSourceInput(_ context.Context) (datasource.DataSourceWithConfigure, error) { return &dataSourceInput{}, nil } @@ -31,7 +31,7 @@ type dataSourceInput struct { framework.DataSourceWithConfigure } -func (d *dataSourceInput) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { // nosemgrep:ci.meta-in-func-name +func (d *dataSourceInput) Metadata(_ context.Context, _ datasource.MetadataRequest, resp *datasource.MetadataResponse) { // nosemgrep:ci.meta-in-func-name resp.TypeName = "aws_medialive_input" } diff --git a/internal/service/medialive/input_data_source_test.go b/internal/service/medialive/input_data_source_test.go index 4575d21aa72..3f30d227b98 100644 --- a/internal/service/medialive/input_data_source_test.go +++ b/internal/service/medialive/input_data_source_test.go @@ -5,92 +5,33 @@ package medialive_test import ( "fmt" - "strings" "testing" - "github.com/YakDriver/regexache" - "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/service/medialive" - "github.com/aws/aws-sdk-go-v2/service/medialive/types" - "github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2/tfawserr" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest" "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-plugin-testing/terraform" "github.com/hashicorp/terraform-provider-aws/internal/acctest" - "github.com/hashicorp/terraform-provider-aws/internal/conns" - "github.com/hashicorp/terraform-provider-aws/internal/create" - tfmedialive "github.com/hashicorp/terraform-provider-aws/internal/service/medialive" "github.com/hashicorp/terraform-provider-aws/names" ) -func TestInputExampleUnitTest(t *testing.T) { - t.Parallel() - - testCases := []struct { - TestName string - Input string - Expected string - Error bool - }{ - { - TestName: "empty", - Input: "", - Expected: "", - Error: true, - }, - { - TestName: "descriptive name", - Input: "some input", - Expected: "some output", - Error: false, - }, - { - TestName: "another descriptive name", - Input: "more input", - Expected: "more output", - Error: false, - }, - } - - for _, testCase := range testCases { - testCase := testCase - t.Run(testCase.TestName, func(t *testing.T) { - t.Parallel() - got, err := tfmedialive.FunctionFromDataSource(testCase.Input) - - if err != nil && !testCase.Error { - t.Errorf("got error (%s), expected no error", err) - } - - if err == nil && testCase.Error { - t.Errorf("got (%s) and no error, expected error", got) - } - - if got != testCase.Expected { - t.Errorf("got %s, expected %s", got, testCase.Expected) - } - }) - } -} - func TestAccMediaLiveInputDataSource_basic(t *testing.T) { ctx := acctest.Context(t) if testing.Short() { t.Skip("skipping long-running test in short mode") } - var input medialive.DescribeInputResponse + var input medialive.DescribeInputOutput rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + resourceName := "aws_medialive_input.test" dataSourceName := "data.aws_medialive_input.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) acctest.PreCheckPartitionHasService(t, names.MediaLiveEndpointID) - testAccPreCheck(ctx, t) + testAccInputsPreCheck(ctx, t) }, - ErrorCheck: acctest.ErrorCheck(t, names.MediaLiveEndpointID), + ErrorCheck: acctest.ErrorCheck(t, names.MediaLiveServiceID), ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, CheckDestroy: testAccCheckInputDestroy(ctx), Steps: []resource.TestStep{ @@ -98,44 +39,37 @@ func TestAccMediaLiveInputDataSource_basic(t *testing.T) { Config: testAccInputDataSourceConfig_basic(rName), Check: resource.ComposeTestCheckFunc( testAccCheckInputExists(ctx, dataSourceName, &input), - resource.TestCheckResourceAttr(dataSourceName, "auto_minor_version_upgrade", "false"), - resource.TestCheckResourceAttrSet(dataSourceName, "maintenance_window_start_time.0.day_of_week"), - resource.TestCheckTypeSetElemNestedAttrs(dataSourceName, "user.*", map[string]string{ - "console_access": "false", - "groups.#": "0", - "username": "Test", - "password": "TestTest1234", - }), - acctest.MatchResourceAttrRegionalARN(dataSourceName, "arn", "medialive", regexache.MustCompile(`input:+.`)), + resource.TestCheckResourceAttrPair(resourceName, "arn", dataSourceName, "arn"), ), }, }, }) } -func testAccInputDataSourceConfig_basic(rName, version string) string { +func testAccInputDataSourceConfig_basic(rName string) string { return fmt.Sprintf(` -data "aws_security_group" "test" { - name = %[1]q +resource "aws_medialive_input_security_group" "test" { + whitelist_rules { + cidr = "10.0.0.8/32" + } + + tags = { + Name = %[1]q + } } -data "aws_medialive_input" "test" { - input_name = %[1]q - engine_type = "ActiveMediaLive" - engine_version = %[2]q - host_instance_type = "medialive.t2.micro" - security_groups = [aws_security_group.test.id] - authentication_strategy = "simple" - storage_type = "efs" +resource "aws_medialive_input" "test" { + name = %[1]q + input_security_groups = [aws_medialive_input_security_group.test.id] + type = "UDP_PUSH" - logs { - general = true + tags = { + Name = %[1]q } +} - user { - username = "Test" - password = "TestTest1234" - } +data "aws_medialive_input" "test" { + id = aws_medialive_input.test.id } -`, rName, version) +`, rName) } diff --git a/website/docs/d/medialive_input.html.markdown b/website/docs/d/medialive_input.html.markdown index fde18238879..ca06b6244fc 100644 --- a/website/docs/d/medialive_input.html.markdown +++ b/website/docs/d/medialive_input.html.markdown @@ -16,6 +16,7 @@ Terraform data source for managing an AWS Elemental MediaLive Input. ```terraform data "aws_medialive_input" "example" { + id = aws_medialive_input.example.id } ``` @@ -23,15 +24,24 @@ data "aws_medialive_input" "example" { The following arguments are required: -* `example_arg` - (Required) Concise argument description. Do not begin the description with "An", "The", "Defines", "Indicates", or "Specifies," as these are verbose. In other words, "Indicates the amount of storage," can be rewritten as "Amount of storage," without losing any information. - -The following arguments are optional: - -* `optional_arg` - (Optional) Concise argument description. Do not begin the description with "An", "The", "Defines", "Indicates", or "Specifies," as these are verbose. In other words, "Indicates the amount of storage," can be rewritten as "Amount of storage," without losing any information. +* `id` - (Required) The ID of the Input. ## Attribute Reference This data source exports the following attributes in addition to the arguments above: -* `arn` - ARN of the Input. Do not begin the description with "An", "The", "Defines", "Indicates", or "Specifies," as these are verbose. In other words, "Indicates the amount of storage," can be rewritten as "Amount of storage," without losing any information. -* `example_attribute` - Concise description. Do not begin the description with "An", "The", "Defines", "Indicates", or "Specifies," as these are verbose. In other words, "Indicates the amount of storage," can be rewritten as "Amount of storage," without losing any information. \ No newline at end of file +* `arn` - ARN of the Input. +* `attached_channels` - Channels attached to Input. +* `destionations` - Destination settings for PUSH type inputs. +* `input_class` - The input class. +* `input_devices` - Settings for the devices. +* `input_partner_ids` - A list of IDs for all Inputs which are partners of this one. +* `input_source_type` - Source type of the input. +* `media_connect_flows` - A list of the MediaConnect Flows. +* `name` - Name of the input. +* `role_arn` - The ARN of the role this input assumes during and after creation. +* `security_groups` - List of input security groups. +* `sources` - The source URLs for a PULL-type input. +* `state` - The state of the input. +* `tags` - A map of tags assigned to the Input. +* `type` - The type of the input. \ No newline at end of file From b26ec0bfdf7749a627af1ebb850a64479648fb27 Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Mon, 11 Mar 2024 16:13:00 -0500 Subject: [PATCH 3/5] aws_medialive_input: update test --- internal/service/medialive/input_data_source.go | 2 ++ internal/service/medialive/input_data_source_test.go | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/internal/service/medialive/input_data_source.go b/internal/service/medialive/input_data_source.go index 8efdf09edf0..430a746f4c8 100644 --- a/internal/service/medialive/input_data_source.go +++ b/internal/service/medialive/input_data_source.go @@ -121,6 +121,8 @@ func (d *dataSourceInput) Read(ctx context.Context, req datasource.ReadRequest, return } + data.Tags = fwflex.FlattenFrameworkStringValueMap(ctx, out.Tags) + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) } diff --git a/internal/service/medialive/input_data_source_test.go b/internal/service/medialive/input_data_source_test.go index 3f30d227b98..46227fd8ab2 100644 --- a/internal/service/medialive/input_data_source_test.go +++ b/internal/service/medialive/input_data_source_test.go @@ -40,6 +40,17 @@ func TestAccMediaLiveInputDataSource_basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckInputExists(ctx, dataSourceName, &input), resource.TestCheckResourceAttrPair(resourceName, "arn", dataSourceName, "arn"), + resource.TestCheckResourceAttrPair(resourceName, "name", dataSourceName, "name"), + resource.TestCheckResourceAttr(dataSourceName, "destinations.#", "2"), + resource.TestCheckResourceAttrPair(resourceName, "input_class", dataSourceName, "input_class"), + resource.TestCheckResourceAttrPair(resourceName, "input_devices", dataSourceName, "input_devices"), + resource.TestCheckResourceAttrPair(resourceName, "input_partner_ids", dataSourceName, "input_partner_ids"), + resource.TestCheckResourceAttrPair(resourceName, "input_source_type", dataSourceName, "input_source_type"), + resource.TestCheckResourceAttrPair(resourceName, "security_groups", dataSourceName, "security_groups"), + resource.TestCheckResourceAttrPair(resourceName, "sources", dataSourceName, "sources"), + resource.TestCheckResourceAttrSet(dataSourceName, "state"), + resource.TestCheckResourceAttrPair(resourceName, "tag_all", dataSourceName, "tags"), + resource.TestCheckResourceAttrPair(resourceName, "type", dataSourceName, "type"), ), }, }, From a77228cb816ddf60c010bb74178a13d8566fc235 Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Mon, 11 Mar 2024 16:21:37 -0500 Subject: [PATCH 4/5] chore: linter --- website/docs/d/medialive_input.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/d/medialive_input.html.markdown b/website/docs/d/medialive_input.html.markdown index ca06b6244fc..92ca81ac12b 100644 --- a/website/docs/d/medialive_input.html.markdown +++ b/website/docs/d/medialive_input.html.markdown @@ -44,4 +44,4 @@ This data source exports the following attributes in addition to the arguments a * `sources` - The source URLs for a PULL-type input. * `state` - The state of the input. * `tags` - A map of tags assigned to the Input. -* `type` - The type of the input. \ No newline at end of file +* `type` - The type of the input. From ff59c89e61108bc7256228b38b52f2f9adaf99de Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Mon, 11 Mar 2024 16:26:11 -0500 Subject: [PATCH 5/5] add CHANGELOG entry --- .changelog/36307.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/36307.txt diff --git a/.changelog/36307.txt b/.changelog/36307.txt new file mode 100644 index 00000000000..308882e12a8 --- /dev/null +++ b/.changelog/36307.txt @@ -0,0 +1,3 @@ +```release-note:new-data-source +aws_medialive_input +``` \ No newline at end of file