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

Support Eventbridge Pipes parameters #31607

Merged
merged 68 commits into from
Jun 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
bd781d4
Support Eventbridge Pipes parameters
jordanfinners Apr 16, 2023
8794d92
Merge branch 'main' into HEAD
ewbankkit Jun 9, 2023
e80db56
r/aws_pipes_pipe: Alphabetize attributes.
ewbankkit Jun 9, 2023
76d73ea
Add CHANGELOG entry.
ewbankkit Jun 9, 2023
cc443f8
Tidy up 'enrichment_parameters'.
ewbankkit Jun 9, 2023
bc29dd0
Tidy up 'source_parameters'.
ewbankkit Jun 9, 2023
24b9f39
Tidy up 'target_parameters'.
ewbankkit Jun 9, 2023
3229613
'sage_maker_pipeline' -> 'sagemaker_pipeline'.
ewbankkit Jun 9, 2023
3d5cef3
pipes: Use 'go-cmp' in unit tests.
ewbankkit Jun 9, 2023
270783e
pipes: Use 'reflect.DeepEquals' in unit tests.
ewbankkit Jun 9, 2023
10324c7
Revert "pipes: Use 'reflect.DeepEquals' in unit tests."
ewbankkit Jun 9, 2023
bc9e9a3
Revert "pipes: Use 'go-cmp' in unit tests."
ewbankkit Jun 9, 2023
e93fbba
r/aws_pipes_pipe: 'enrichment_parameters.http_parameters' changes.
ewbankkit Jun 9, 2023
1299833
r/aws_pipes_pipe: 'source_parameters.filter_criteria' changes.
ewbankkit Jun 11, 2023
f67104c
r/aws_pipes_pipe: 'source_parameters.sqs_queue' -> 'source_parameters…
ewbankkit Jun 12, 2023
fc4286f
r/aws_pipes_pipe: 'source_parameters.dynamo_db_stream' -> 'source_par…
ewbankkit Jun 12, 2023
3e6bfec
r/aws_pipes_pipe: 'source_parameters.active_mq_broker' -> 'source_par…
ewbankkit Jun 12, 2023
526fce8
r/aws_pipes_pipe: 'source_parameters.kinesis_stream' -> 'source_param…
ewbankkit Jun 13, 2023
e0b8793
r/aws_pipes_pipe: 'source_parameters.managed_streaming_kafka' -> 'sou…
ewbankkit Jun 13, 2023
f37a79b
r/aws_pipes_pipe: 'source_parameters.rabbit_mq_broker' -> 'source_par…
ewbankkit Jun 13, 2023
0fb4858
r/aws_pipes_pipe: 'source_parameters.self_managed_kafka' -> 'source_p…
ewbankkit Jun 13, 2023
85b0060
r/aws_pipes_pipe: Fill out 'expandUpdatePipeSourceParameters'.
ewbankkit Jun 13, 2023
b2363d3
Update CHANGELOG entry.
ewbankkit Jun 13, 2023
9c7c8c1
r/aws_pipes_pipe: 'target_parameters.step_function' -> 'target_parame…
ewbankkit Jun 13, 2023
ef71c23
r/aws_pipes_pipe: 'target_parameters.sqs_queue' -> 'target_parameters…
ewbankkit Jun 13, 2023
4df4d06
r/aws_pipes_pipe: 'target_parameters.sagemaker_pipeline' -> 'target_p…
ewbankkit Jun 13, 2023
f24f40a
r/aws_pipes_pipe: 'target_parameters.redshift_data' -> 'target_parame…
ewbankkit Jun 13, 2023
c0865b2
r/aws_pipes_pipe: 'target_parameters.lambda_function' -> 'target_para…
ewbankkit Jun 13, 2023
92d6154
r/aws_pipes_pipe: 'target_parameters.kinesis_stream_parameters' -> 't…
ewbankkit Jun 13, 2023
121c107
r/aws_pipes_pipe: Modify 'target_parameters.http_parameters'.
ewbankkit Jun 13, 2023
8080fa9
r/aws_pipes_pipe: 'target_parameters.event_bridge_event_bus' -> 'targ…
ewbankkit Jun 13, 2023
0a20bb7
r/aws_pipes_pipe: 'target_parameters.cloudwatch_logs' -> 'target_para…
ewbankkit Jun 13, 2023
a93645e
r/aws_pipes_pipe: 'target_parameters.batch_target' -> 'target_paramet…
ewbankkit Jun 13, 2023
d77d3c5
r/aws_pipes_pipe: 'target_parameters.ecs_task' -> 'target_parameters.…
ewbankkit Jun 14, 2023
ccd8ab6
r/aws_pipes_pipe: Consolidate source files.
ewbankkit Jun 14, 2023
f1006ce
Merge branch 'main' into HEAD
ewbankkit Jun 14, 2023
24b6f1a
r/aws_pipes_pipe: Remove defaults from 'target_parameters'.
ewbankkit Jun 14, 2023
09188e0
Revert "r/aws_pipes_pipe: Remove defaults from 'target_parameters'."
ewbankkit Jun 14, 2023
0e90c63
r/aws_pipes_pipe: Use 'reflect.ValueOf().IsZero()' to detect empty re…
ewbankkit Jun 14, 2023
f6daaff
r/aws_pipes_pipe: Tidy up acceptance tests.
ewbankkit Jun 14, 2023
23db5f7
r/aws_pipes_pipe: Remove defaults from 'source_parameters'.
ewbankkit Jun 14, 2023
b7c73e9
r/aws_pipes_pipe: Remove defaults from 'target_parameters'.
ewbankkit Jun 14, 2023
7a53bdc
r/aws_pipes_pipe: Some Computed attributes for 'source_parameters'.
ewbankkit Jun 14, 2023
3cdb6b5
r/aws_pipes_pipe: Remove DiffSuppressFunc from 'target_parameters'.
ewbankkit Jun 14, 2023
d84df7c
r/aws_pipes_pipe: Original acceptance tests passing.
ewbankkit Jun 15, 2023
02b9d32
Use 'enum.Slice'.
ewbankkit Jun 19, 2023
2c77f7a
'TestAccPipesPipe_target' -> 'TestAccPipesPipe_targetUpdate'.
ewbankkit Jun 20, 2023
a8ba9f9
r/aws_pipes_pipe: Add 'TestAccPipesPipe_basicKinesis'.
ewbankkit Jun 24, 2023
886249e
Merge branch 'main' into HEAD
ewbankkit Jun 24, 2023
a516120
Add 'types.IsZero'.
ewbankkit Jun 24, 2023
026fde6
r/aws_pipes_pipe: Use 'types.IsZero'.
ewbankkit Jun 24, 2023
c79ef82
r/aws_pipes_pipe: Add 'TestAccPipesPipe_dynamoDBSourceCloudWatchLogsT…
ewbankkit Jun 24, 2023
f00ee8b
r/aws_pipes_pipe: Add 'TestAccPipesPipe_activeMQSourceStepFunctionTar…
ewbankkit Jun 24, 2023
5e2374f
r/aws_pipes_pipe: Add 'TestAccPipesPipe_rabbitMQSourceEventBusTarget'.
ewbankkit Jun 24, 2023
b3bd872
Add 'TestAccPipesPipe_mskSourceHTTPTarget'.
ewbankkit Jun 26, 2023
2181c3e
Add 'TestAccPipesPipe_selfManagedKafkaSourceLambdaFunctionTarget'.
ewbankkit Jun 26, 2023
4dac458
r/aws_pipes_pipe: Add 'TestAccPipesPipe_sqsSourceRedshiftTarget'.
ewbankkit Jun 26, 2023
77bd4d5
Add 'TestAccPipesPipe_sqsSourceSagemakerTarget'.
ewbankkit Jun 26, 2023
cfd5554
% make testacc TESTARGS='-run=TestAccPipesPipe_sqsSourceBatchJobTarge…
ewbankkit Jun 26, 2023
80b2a9b
Add 'TestAccPipesPipe_sqsSourceECSTaskTarget'.
ewbankkit Jun 26, 2023
c3d1cac
r/aws_pipes_pipe: Add 'TestAccPipesPipe_enrichmentParameters'.
ewbankkit Jun 26, 2023
622cb2a
Fix terrafmt errors in acceptance test configurations.
ewbankkit Jun 26, 2023
db237c6
Fix markdown-lint 'MD012/no-multiple-blanks Multiple consecutive blan…
ewbankkit Jun 26, 2023
4d08912
Fix semgrep errors.
ewbankkit Jun 26, 2023
517e8a2
Add NOTE to CHANGELOG entries.
ewbankkit Jun 26, 2023
bbb25ff
Fix golangci-lint 'paralleltest'.
ewbankkit Jun 26, 2023
a2c7ca6
Fix golangci-lint 'unused'.
ewbankkit Jun 26, 2023
969b6a4
Fix golangci-lint 'staticcheck'.
ewbankkit Jun 26, 2023
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
11 changes: 11 additions & 0 deletions .changelog/31607.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
```release-note:enhancement
resource/aws_pipes_pipe: Add `enrichment_parameters` argument
```

```release-note:enhancement
resource/aws_pipes_pipe: Add `activemq_broker_parameters`, `dynamodb_stream_parameters`, `kinesis_stream_parameters`, `managed_streaming_kafka_parameters`, `rabbitmq_broker_parameters`, `self_managed_kafka_parameters` and `sqs_queue_parameters` attributes to the `source_parameters` configuration block. NOTE: Because we cannot easily test all this functionality, it is best effort and we ask for community help in testing
```

```release-note:enhancement
resource/aws_pipes_pipe: Add `batch_job_parameters`, `cloudwatch_logs_parameters`, `ecs_task_parameters`, `eventbridge_event_bus_parameters`, `http_parameters`, `kinesis_stream_parameters`, `lambda_function_parameters`, `redshift_data_parameters`, `sagemaker_pipeline_parameters`, `sqs_queue_parameters` and `step_function_state_machine_parameters` attributes to the `target_parameters` configuration block. NOTE: Because we cannot easily test all this functionality, it is best effort and we ask for community help in testing
```
133 changes: 133 additions & 0 deletions internal/service/pipes/enrichment_parameters.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
package pipes

import (
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/service/pipes/types"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
"github.com/hashicorp/terraform-provider-aws/internal/flex"
)

func enrichmentParametersSchema() *schema.Schema {
return &schema.Schema{
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"http_parameters": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"header_parameters": {
Type: schema.TypeMap,
Optional: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
"path_parameter_values": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
"query_string_parameters": {
Type: schema.TypeMap,
Optional: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
},
},
},
"input_template": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringLenBetween(0, 8192),
},
},
},
}
}

func expandPipeEnrichmentParameters(tfMap map[string]interface{}) *types.PipeEnrichmentParameters {
if tfMap == nil {
return nil
}

apiObject := &types.PipeEnrichmentParameters{}

if v, ok := tfMap["http_parameters"].([]interface{}); ok && len(v) > 0 && v[0] != nil {
apiObject.HttpParameters = expandPipeEnrichmentHTTPParameters(v[0].(map[string]interface{}))
}

if v, ok := tfMap["input_template"].(string); ok && v != "" {
apiObject.InputTemplate = aws.String(v)
}

return apiObject
}

func expandPipeEnrichmentHTTPParameters(tfMap map[string]interface{}) *types.PipeEnrichmentHttpParameters {
if tfMap == nil {
return nil
}

apiObject := &types.PipeEnrichmentHttpParameters{}

if v, ok := tfMap["header_parameters"].(map[string]interface{}); ok && len(v) > 0 {
apiObject.HeaderParameters = flex.ExpandStringValueMap(v)
}

if v, ok := tfMap["path_parameter_values"].([]interface{}); ok && len(v) > 0 {
apiObject.PathParameterValues = flex.ExpandStringValueList(v)
}

if v, ok := tfMap["query_string_parameters"].(map[string]interface{}); ok && len(v) > 0 {
apiObject.QueryStringParameters = flex.ExpandStringValueMap(v)
}

return apiObject
}

func flattenPipeEnrichmentParameters(apiObject *types.PipeEnrichmentParameters) map[string]interface{} {
if apiObject == nil {
return nil
}

tfMap := map[string]interface{}{}

if v := apiObject.HttpParameters; v != nil {
tfMap["http_parameters"] = []interface{}{flattenPipeEnrichmentHTTPParameters(v)}
}

if v := apiObject.InputTemplate; v != nil {
tfMap["input_template"] = aws.ToString(v)
}

return tfMap
}

func flattenPipeEnrichmentHTTPParameters(apiObject *types.PipeEnrichmentHttpParameters) map[string]interface{} {
if apiObject == nil {
return nil
}

tfMap := map[string]interface{}{}

if v := apiObject.HeaderParameters; v != nil {
tfMap["header_parameters"] = v
}

if v := apiObject.PathParameterValues; v != nil {
tfMap["path_parameter_values"] = v
}

if v := apiObject.QueryStringParameters; v != nil {
tfMap["query_string_parameters"] = v
}

return tfMap
}
8 changes: 8 additions & 0 deletions internal/service/pipes/exports_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package pipes

// Exports for use in tests only.
var (
FindPipeByName = findPipeByName

ResourcePipe = resourcePipe
)
37 changes: 0 additions & 37 deletions internal/service/pipes/find.go

This file was deleted.

146 changes: 0 additions & 146 deletions internal/service/pipes/flex.go

This file was deleted.

Loading