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

Add vpcid rds subnetgroup vpcid #30775

Merged
merged 4 commits into from
Apr 21, 2023
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/30775.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/aws_db_subnet_group: Add `vpc_id` attribute
```
5 changes: 5 additions & 0 deletions internal/service/rds/subnet_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ func ResourceSubnetGroup() *schema.Resource {
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
"vpc_id": {
Type: schema.TypeString,
Computed: true,
},
names.AttrTags: tftags.TagsSchema(),
names.AttrTagsAll: tftags.TagsSchemaComputed(),
},
Expand Down Expand Up @@ -126,6 +130,7 @@ func resourceSubnetGroupRead(ctx context.Context, d *schema.ResourceData, meta i
}
d.Set("subnet_ids", subnetIDs)
d.Set("supported_network_types", aws.StringValueSlice(v.SupportedNetworkTypes))
d.Set("vpc_id", v.VpcId)

return diags
}
Expand Down
1 change: 1 addition & 0 deletions internal/service/rds/subnet_group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ func TestAccRDSSubnetGroup_basic(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "subnet_ids.#", "2"),
resource.TestCheckResourceAttr(resourceName, "supported_network_types.#", "1"),
resource.TestCheckTypeSetElemAttr(resourceName, "supported_network_types.*", "IPV4"),
resource.TestCheckResourceAttrSet(resourceName, "vpc_id"),
resource.TestCheckResourceAttr(resourceName, "tags.%", "0"),
),
},
Expand Down
1 change: 1 addition & 0 deletions website/docs/r/db_subnet_group.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ In addition to all arguments above, the following attributes are exported:
* `arn` - The ARN of the db subnet group.
* `supported_network_types` - The network type of the db subnet group.
* `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).
* `vpc_id` - Provides the VPC ID of the DB subnet group.

## Import

Expand Down