Skip to content

Commit 4cc15e6

Browse files
authored
Merge pull request #30775 from stevendborrelli/f-rds-subnetgroup-vpcid
Add vpcid rds subnetgroup vpcid
2 parents 7228e20 + b406733 commit 4cc15e6

File tree

4 files changed

+10
-0
lines changed

4 files changed

+10
-0
lines changed

.changelog/30775.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
resource/aws_db_subnet_group: Add `vpc_id` attribute
3+
```

internal/service/rds/subnet_group.go

+5
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ func ResourceSubnetGroup() *schema.Resource {
6868
Computed: true,
6969
Elem: &schema.Schema{Type: schema.TypeString},
7070
},
71+
"vpc_id": {
72+
Type: schema.TypeString,
73+
Computed: true,
74+
},
7175
names.AttrTags: tftags.TagsSchema(),
7276
names.AttrTagsAll: tftags.TagsSchemaComputed(),
7377
},
@@ -126,6 +130,7 @@ func resourceSubnetGroupRead(ctx context.Context, d *schema.ResourceData, meta i
126130
}
127131
d.Set("subnet_ids", subnetIDs)
128132
d.Set("supported_network_types", aws.StringValueSlice(v.SupportedNetworkTypes))
133+
d.Set("vpc_id", v.VpcId)
129134

130135
return diags
131136
}

internal/service/rds/subnet_group_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ func TestAccRDSSubnetGroup_basic(t *testing.T) {
4040
resource.TestCheckResourceAttr(resourceName, "subnet_ids.#", "2"),
4141
resource.TestCheckResourceAttr(resourceName, "supported_network_types.#", "1"),
4242
resource.TestCheckTypeSetElemAttr(resourceName, "supported_network_types.*", "IPV4"),
43+
resource.TestCheckResourceAttrSet(resourceName, "vpc_id"),
4344
resource.TestCheckResourceAttr(resourceName, "tags.%", "0"),
4445
),
4546
},

website/docs/r/db_subnet_group.html.markdown

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ In addition to all arguments above, the following attributes are exported:
4343
* `arn` - The ARN of the db subnet group.
4444
* `supported_network_types` - The network type of the db subnet group.
4545
* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block).
46+
* `vpc_id` - Provides the VPC ID of the DB subnet group.
4647

4748
## Import
4849

0 commit comments

Comments
 (0)