diff --git a/.changelog/32477.txt b/.changelog/32477.txt new file mode 100644 index 00000000000..8ba0cdaa178 --- /dev/null +++ b/.changelog/32477.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +data-source/aws_db_instance: Add `max_allocated_storage` attribute +``` diff --git a/internal/service/rds/instance_data_source.go b/internal/service/rds/instance_data_source.go index 4c3f4b1cb4c..97eeb472ae2 100644 --- a/internal/service/rds/instance_data_source.go +++ b/internal/service/rds/instance_data_source.go @@ -138,6 +138,10 @@ func DataSourceInstance() *schema.Resource { }, }, }, + "max_allocated_storage": { + Type: schema.TypeInt, + Computed: true, + }, "monitoring_interval": { Type: schema.TypeInt, Computed: true, @@ -252,6 +256,7 @@ func dataSourceInstanceRead(ctx context.Context, d *schema.ResourceData, meta in return sdkdiag.AppendErrorf(diags, "setting master_user_secret: %s", err) } } + d.Set("max_allocated_storage", v.MaxAllocatedStorage) d.Set("monitoring_interval", v.MonitoringInterval) d.Set("monitoring_role_arn", v.MonitoringRoleArn) d.Set("multi_az", v.MultiAZ) diff --git a/internal/service/rds/instance_data_source_test.go b/internal/service/rds/instance_data_source_test.go index fb96da69cc6..bada70ef351 100644 --- a/internal/service/rds/instance_data_source_test.go +++ b/internal/service/rds/instance_data_source_test.go @@ -44,6 +44,7 @@ func TestAccRDSInstanceDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrPair(dataSourceName, "hosted_zone_id", resourceName, "hosted_zone_id"), resource.TestCheckResourceAttrPair(dataSourceName, "iops", resourceName, "iops"), resource.TestCheckResourceAttrPair(dataSourceName, "master_username", resourceName, "username"), + resource.TestCheckResourceAttrPair(dataSourceName, "max_allocated_storage", resourceName, "max_allocated_storage"), resource.TestCheckResourceAttrPair(dataSourceName, "multi_az", resourceName, "multi_az"), resource.TestCheckResourceAttrPair(dataSourceName, "network_type", resourceName, "network_type"), resource.TestCheckResourceAttrPair(dataSourceName, "port", resourceName, "port"), @@ -120,6 +121,7 @@ resource "aws_db_instance" "test" { password = "avoid-plaintext-passwords" skip_final_snapshot = true username = "tfacctest" + max_allocated_storage = 100 enabled_cloudwatch_logs_exports = [ "audit", diff --git a/website/docs/d/db_instance.html.markdown b/website/docs/d/db_instance.html.markdown index de7e872520a..fdcb320f7a9 100644 --- a/website/docs/d/db_instance.html.markdown +++ b/website/docs/d/db_instance.html.markdown @@ -52,6 +52,7 @@ In addition to all arguments above, the following attributes are exported: * `license_model` - License model information for this DB instance. * `master_username` - Contains the master username for the DB instance. * `master_user_secret` - Provides the master user secret. Only available when `manage_master_user_password` is set to true. [Documented below](#master_user_secret). +* `max_allocated_storage` - The upper limit to which Amazon RDS can automatically scale the storage of the DB instance. * `monitoring_interval` - Interval, in seconds, between points when Enhanced Monitoring metrics are collected for the DB instance. * `monitoring_role_arn` - ARN for the IAM role that permits RDS to send Enhanced Monitoring metrics to CloudWatch Logs. * `multi_az` - If the DB instance is a Multi-AZ deployment.