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

r/aws_rds_integration: add data_filter argument #40816

Merged
merged 1 commit into from
Jan 9, 2025
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 .changelog/40816.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/aws_rds_integration: Add `data_filter` argument
```
12 changes: 11 additions & 1 deletion internal/service/rds/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,15 @@ func (r *integrationResource) Schema(ctx context.Context, request resource.Schem
},
},
names.AttrARN: framework.ARNAttributeComputedOnly(),
names.AttrID: framework.IDAttribute(),
"data_filter": schema.StringAttribute{
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.RequiresReplace(),
stringplanmodifier.UseStateForUnknown(),
},
},
names.AttrID: framework.IDAttribute(),
"integration_name": schema.StringAttribute{
Required: true,
PlanModifiers: []planmodifier.String{
Expand Down Expand Up @@ -160,6 +168,7 @@ func (r *integrationResource) Create(ctx context.Context, request resource.Creat

// Set values for unknowns.
data.KMSKeyID = fwflex.StringToFramework(ctx, integration.KMSKeyId)
data.DataFilter = fwflex.StringToFramework(ctx, integration.DataFilter)

response.Diagnostics.Append(response.State.Set(ctx, data)...)
}
Expand Down Expand Up @@ -352,6 +361,7 @@ func integrationError(v awstypes.IntegrationError) error {

type integrationResourceModel struct {
AdditionalEncryptionContext fwtypes.MapValueOf[types.String] `tfsdk:"additional_encryption_context"`
DataFilter types.String `tfsdk:"data_filter"`
ID types.String `tfsdk:"id"`
IntegrationARN types.String `tfsdk:"arn"`
IntegrationName types.String `tfsdk:"integration_name"`
Expand Down
4 changes: 4 additions & 0 deletions internal/service/rds/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ func TestAccRDSIntegration_basic(t *testing.T) {
Check: resource.ComposeAggregateTestCheckFunc(
testAccCheckIntegrationExists(ctx, resourceName, &integration),
resource.TestCheckResourceAttr(resourceName, "integration_name", rName),
resource.TestCheckResourceAttr(resourceName, "data_filter", "include: *.*"),
resource.TestCheckResourceAttrPair(resourceName, "source_arn", "aws_rds_cluster.test", names.AttrARN),
resource.TestCheckResourceAttr(resourceName, acctest.CtTagsPercent, "0"),
resource.TestCheckResourceAttrPair(resourceName, names.AttrTargetARN, "aws_redshiftserverless_namespace.test", names.AttrARN),
Expand Down Expand Up @@ -123,6 +124,7 @@ func TestAccRDSIntegration_optional(t *testing.T) {
Check: resource.ComposeAggregateTestCheckFunc(
testAccCheckIntegrationExists(ctx, resourceName, &integration),
resource.TestCheckResourceAttr(resourceName, "integration_name", rName),
resource.TestCheckResourceAttr(resourceName, "data_filter", "include: test.mytable"),
resource.TestCheckResourceAttrPair(resourceName, names.AttrKMSKeyID, "aws_kms_key.test", names.AttrARN),
resource.TestCheckResourceAttrPair(resourceName, "source_arn", "aws_rds_cluster.test", names.AttrARN),
resource.TestCheckResourceAttrPair(resourceName, names.AttrTargetARN, "aws_redshiftserverless_namespace.test", names.AttrARN),
Expand Down Expand Up @@ -453,6 +455,8 @@ resource "aws_rds_integration" "test" {
"department" : "test",
}

data_filter = "include: test.mytable"

tags = {
Name = %[1]q
}
Expand Down
17 changes: 11 additions & 6 deletions website/docs/r/rds_integration.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,22 @@ For more detailed documentation about each argument, refer to the [AWS official
The following arguments are required:

* `integration_name` - (Required, Forces new resources) Name of the integration.

* `source_arn` - (Required, Forces new resources) ARN of the database to use as the source for replication.

* `target_arn` - (Required, Forces new resources) ARN of the Redshift data warehouse to use as the target for replication.

The following arguments are optional:

* `kms_key_id` - (Optional, Forces new resources) KMS key identifier for the key to use to encrypt the integration. If you don't specify an encryption key, RDS uses a default AWS owned key. If you use the default AWS owned key, you should ignore `kms_key_id` parameter by using [`lifecycle` parameter](https://developer.hashicorp.com/terraform/language/meta-arguments/lifecycle#ignore_changes) to avoid unintended change after the first creation.

* `additional_encryption_context` - (Optional, Forces new resources) Set of non-secret key–value pairs that contains additional contextual information about the data. For more information, see the [User Guide](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context). You can only include this parameter if you specify the `kms_key_id` parameter.

* `additional_encryption_context` - (Optional, Forces new resources) Set of non-secret key–value pairs that contains additional contextual information about the data.
For more information, see the [User Guide](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context).
You can only include this parameter if you specify the `kms_key_id` parameter.
* `data_filter` - (Optional, Forces new resources) Data filters for the integration.
These filters determine which tables from the source database are sent to the target Amazon Redshift data warehouse.
The value should match the syntax from the AWS CLI which includes an `include:` or `exclude:` prefix before a filter expression.
Multiple expressions are separated by a comma.
See the [Amazon RDS data filtering guide](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/zero-etl.filtering.html) for additional details.
* `kms_key_id` - (Optional, Forces new resources) KMS key identifier for the key to use to encrypt the integration.
If you don't specify an encryption key, RDS uses a default AWS owned key.
If you use the default AWS owned key, you should ignore `kms_key_id` parameter by using [`lifecycle` parameter](https://developer.hashicorp.com/terraform/language/meta-arguments/lifecycle#ignore_changes) to avoid unintended change after the first creation.
* `tags` - (Optional) Key-value map of resource tags. If configured with a provider [`default_tags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level.

## Attribute Reference
Expand Down
Loading