diff --git a/awsmt/data_source_source_location.go b/awsmt/data_source_source_location.go index cb0aa60..49ab29f 100644 --- a/awsmt/data_source_source_location.go +++ b/awsmt/data_source_source_location.go @@ -13,19 +13,6 @@ func dataSourceSourceLocation() *schema.Resource { return &schema.Resource{ ReadContext: dataSourceSourceLocationRead, Schema: map[string]*schema.Schema{ - "access_configuration": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "access_type": &computedString, - // SMATC is short for Secret Manager Access Token Configuration - "smatc_header_name": &computedString, - "smatc_secret_arn": &computedString, - "smatc_secret_string_key": &computedString, - }, - }, - }, "arn": &computedString, "creation_time": &computedString, "default_segment_delivery_configuration_url": &computedString, diff --git a/awsmt/data_source_source_location_test.go b/awsmt/data_source_source_location_test.go index c1442bc..7a8c04c 100644 --- a/awsmt/data_source_source_location_test.go +++ b/awsmt/data_source_source_location_test.go @@ -30,9 +30,6 @@ func TestAccSourceLocationDataSourceBasic(t *testing.T) { func testAccSourceLocationDataSourceBasic(rName string) string { return fmt.Sprintf(` resource "awsmt_source_location" "test_data_source"{ - access_configuration { - access_type = "S3_SIGV4" - } default_segment_delivery_configuration_url = "https://www.example.com" http_configuration_url = "https://ott-mediatailor-test.s3.eu-central-1.amazonaws.com/test-img.jpeg" source_location_name = "%[1]s" diff --git a/awsmt/resource_source_location.go b/awsmt/resource_source_location.go index 2dcaa80..eb113b3 100644 --- a/awsmt/resource_source_location.go +++ b/awsmt/resource_source_location.go @@ -9,7 +9,6 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/customdiff" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "strings" ) @@ -26,25 +25,6 @@ func resourceSourceLocation() *schema.Resource { customdiff.ForceNewIfChange("source_location_name", func(ctx context.Context, old, new, meta interface{}) bool { return old.(string) != new.(string) }), ), Schema: map[string]*schema.Schema{ - "access_configuration": { - Type: schema.TypeList, - Optional: true, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - //may require s3:GetObject - "access_type": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: validation.StringInSlice([]string{"S3_SIGV4", "SECRETS_MANAGER_ACCESS_TOKEN"}, false), - }, - // SMATC is short for Secrets Manager Access Token Configuration - "smatc_header_name": &optionalString, - "smatc_secret_arn": &optionalString, - "smatc_secret_string_key": &optionalString, - }, - }, - }, "arn": &computedString, "creation_time": &computedString, "default_segment_delivery_configuration_url": &optionalString, diff --git a/awsmt/resource_source_location_test.go b/awsmt/resource_source_location_test.go index b030ca4..ddb5a67 100644 --- a/awsmt/resource_source_location_test.go +++ b/awsmt/resource_source_location_test.go @@ -169,9 +169,6 @@ resource "awsmt_source_location" "test"{ func testAccSourceLocationConfig_update(rName, exampleString, exampleUrl, baseUrl string) string { return fmt.Sprintf(` resource "awsmt_source_location" "test_update"{ - access_configuration { - access_type = "S3_SIGV4" - } default_segment_delivery_configuration_url = "%[3]s" http_configuration_url = "%[4]s" source_location_name = "%[1]s" diff --git a/awsmt/source_location_helpers.go b/awsmt/source_location_helpers.go index 1bc9fc5..3bd63fa 100644 --- a/awsmt/source_location_helpers.go +++ b/awsmt/source_location_helpers.go @@ -7,30 +7,6 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func setAccessConfiguration(values *mediatailor.DescribeSourceLocationOutput, d *schema.ResourceData) error { - if values.AccessConfiguration != nil && values.AccessConfiguration != &(mediatailor.AccessConfiguration{}) { - temp := map[string]interface{}{} - if values.AccessConfiguration.AccessType != nil { - temp["access_type"] = values.AccessConfiguration.AccessType - } - if values.AccessConfiguration.SecretsManagerAccessTokenConfiguration != nil && values.AccessConfiguration.SecretsManagerAccessTokenConfiguration != &(mediatailor.SecretsManagerAccessTokenConfiguration{}) { - if values.AccessConfiguration.SecretsManagerAccessTokenConfiguration.HeaderName != nil { - temp["smatc_header_name"] = values.AccessConfiguration.SecretsManagerAccessTokenConfiguration.HeaderName - } - if values.AccessConfiguration.SecretsManagerAccessTokenConfiguration.SecretArn != nil { - temp["smatc_secret_arn"] = values.AccessConfiguration.SecretsManagerAccessTokenConfiguration.SecretArn - } - if values.AccessConfiguration.SecretsManagerAccessTokenConfiguration.SecretStringKey != nil { - temp["smatc_secret_string_key"] = values.AccessConfiguration.SecretsManagerAccessTokenConfiguration.SecretStringKey - } - } - if err := d.Set("access_configuration", []interface{}{temp}); err != nil { - return fmt.Errorf("error while setting the access configuration: %w", err) - } - } - return nil -} - func setSegmentDeliveryConfigurations(values *mediatailor.DescribeSourceLocationOutput, d *schema.ResourceData) error { var configurations []map[string]interface{} for _, c := range values.SegmentDeliveryConfigurations { @@ -48,7 +24,6 @@ func setSegmentDeliveryConfigurations(values *mediatailor.DescribeSourceLocation func setSourceLocation(values *mediatailor.DescribeSourceLocationOutput, d *schema.ResourceData) error { var errors []error - errors = append(errors, setAccessConfiguration(values, d)) errors = append(errors, d.Set("arn", values.Arn)) errors = append(errors, d.Set("creation_time", values.CreationTime.String())) if values.DefaultSegmentDeliveryConfiguration != nil && values.DefaultSegmentDeliveryConfiguration != &(mediatailor.DefaultSegmentDeliveryConfiguration{}) { @@ -73,37 +48,6 @@ func setSourceLocation(values *mediatailor.DescribeSourceLocationOutput, d *sche return nil } -func getAccessConfiguration(d *schema.ResourceData) *mediatailor.AccessConfiguration { - if v, ok := d.GetOk("access_configuration"); ok && v.([]interface{})[0] != nil { - val := v.([]interface{})[0].(map[string]interface{}) - temp := mediatailor.AccessConfiguration{} - var accessType string - if v, ok := val["access_type"]; ok { - temp.AccessType = aws.String(v.(string)) - accessType = v.(string) - } - - tempSMATC := mediatailor.SecretsManagerAccessTokenConfiguration{} - if str, ok := val["smatc_header_name"]; ok { - tempSMATC.HeaderName = aws.String(str.(string)) - } - if str, ok := val["smatc_secret_arn"]; ok { - tempSMATC.SecretArn = aws.String(str.(string)) - } - if str, ok := val["smatc_secret_arn"]; ok { - tempSMATC.SecretArn = aws.String(str.(string)) - } - if str, ok := val["smatc_secret_string_key"]; ok { - tempSMATC.SecretStringKey = aws.String(str.(string)) - } - if tempSMATC != (mediatailor.SecretsManagerAccessTokenConfiguration{}) && accessType == "SECRETS_MANAGER_ACCESS_TOKEN" { - temp.SecretsManagerAccessTokenConfiguration = &tempSMATC - } - return &temp - } - return nil -} - func getSegmentDeliveryConfigurations(d *schema.ResourceData) []*mediatailor.SegmentDeliveryConfiguration { if v, ok := d.GetOk("segment_delivery_configurations"); ok && v.([]interface{})[0] != nil { configurations := v.([]interface{}) @@ -130,10 +74,6 @@ func getSegmentDeliveryConfigurations(d *schema.ResourceData) []*mediatailor.Seg func getCreateSourceLocationInput(d *schema.ResourceData) mediatailor.CreateSourceLocationInput { var inputParams mediatailor.CreateSourceLocationInput - if a := getAccessConfiguration(d); a != nil { - inputParams.AccessConfiguration = a - } - if v, ok := d.GetOk("default_segment_delivery_configuration_url"); ok { inputParams.DefaultSegmentDeliveryConfiguration = &mediatailor.DefaultSegmentDeliveryConfiguration{BaseUrl: aws.String(v.(string))} } @@ -167,10 +107,6 @@ func getCreateSourceLocationInput(d *schema.ResourceData) mediatailor.CreateSour func getUpdateSourceLocationInput(d *schema.ResourceData) mediatailor.UpdateSourceLocationInput { var updateParams mediatailor.UpdateSourceLocationInput - if a := getAccessConfiguration(d); a != nil { - updateParams.AccessConfiguration = a - } - if v, ok := d.GetOk("default_segment_delivery_configuration_url"); ok { updateParams.DefaultSegmentDeliveryConfiguration = &mediatailor.DefaultSegmentDeliveryConfiguration{BaseUrl: aws.String(v.(string))} } diff --git a/docs/data-sources/awsmt_source_location.md b/docs/data-sources/awsmt_source_location.md index f8d0fab..d032bf3 100644 --- a/docs/data-sources/awsmt_source_location.md +++ b/docs/data-sources/awsmt_source_location.md @@ -2,6 +2,8 @@ This data source provides information about a MediaTailor Source Location. +~> **NOTE:** The source location data source currently does not support the use of access configuration using Amazon Secrets Manager Access Token. + ## Example Usage ```terraform @@ -26,15 +28,6 @@ In addition to all arguments above, the following attributes are exported: * `last_modified_time` - The timestamp of when the channel was last modified. * `tags` - Key-value mapping of resource tags. - -### `access_configuration` -Access configuration parameters. Configures the type of authentication used to access content from your source location. - -* `access_type` - The type of authentication used to access content from HttpConfiguration::BaseUrl on your source location. Accepted values: "S3_SIGV4" and "SECRETS_MANAGER_ACCESS_TOKEN". [Read More](https://docs.aws.amazon.com/sdk-for-go/api/service/mediatailor/#AccessConfiguration). -* `smatc_header_name` - Part of Secrets Manager Access Token Configuration. The name of the HTTP header used to supply the access token in requests to the source location. -* `smatc_secret_arn` - Part of Secrets Manager Access Token Configuration. The Amazon Resource Name (ARN) of the AWS Secrets Manager secret that contains the access token. -* `smatc_secret_string_key` - Part of Secrets Manager Access Token Configuration. The AWS Secrets Manager SecretString key associated with the access token. - ### `segment_delivery_configurations` (List) A list of the segment delivery configurations associated with this resource. diff --git a/docs/index.md b/docs/index.md index 0d3c32a..4cc4974 100644 --- a/docs/index.md +++ b/docs/index.md @@ -11,7 +11,7 @@ Example configuration (using Terraform 0.13 or newer): terraform { required_providers { awsmt = { - version = "1.13.0" + version = "1.14.1" source = "spring-media/awsmt" } } diff --git a/docs/resources/awsmt_source_location.md b/docs/resources/awsmt_source_location.md index 728669e..edd9800 100644 --- a/docs/resources/awsmt_source_location.md +++ b/docs/resources/awsmt_source_location.md @@ -2,6 +2,8 @@ Use this resource to manage a MediaTailor Source Location. +~> **NOTE:** The source location data source currently does not support the use of access configuration using Amazon Secrets Manager Access Token. + ## Example Usage ```terraform