mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 06:20:24 -05:00
fix(rds): keep the tags given to CreateDBSubnetGroup (#2627)
The handler never read Tags.Tag.N, so a group created with tags answered an empty list to ListTagsForResource — which terraform-provider-aws calls right after the create — although the model already carried a tag map and AddTagsToResource on the group's ARN worked. Store the tags with the group in the same write. DocumentDB subnet groups are the same records through the same scope. Closes #2612
This commit is contained in:
1 parent
b1d7286444
commit
20ecb89155
6 files changed
+88
-7
No files matched your search
@@ -304,7 +304,8 @@ public class RdsQueryHandler {
|
||||
String description = params.getFirst("DBSubnetGroupDescription");
|
||||
List<String> subnetIds = memberList(params, "SubnetIds");
|
||||
try {
|
||||
DbSubnetGroup group = service.createDbSubnetGroup(name, description, subnetIds, region);
|
||||
DbSubnetGroup group = service.createDbSubnetGroup(name, description, subnetIds, region,
|
||||
parseTags(params));
|
||||
return Response.ok(AwsQueryResponse.envelope("CreateDBSubnetGroup",
|
||||
AwsNamespaces.RDS, dbSubnetGroupXml(group))).build();
|
||||
} catch (AwsException e) {
|
||||
|
||||
@@ -2261,6 +2261,15 @@ public class RdsService implements Resettable, ResourceProvider {
|
||||
}
|
||||
|
||||
public DbSubnetGroup createDbSubnetGroup(String name, String description, List<String> subnetIds, String region) {
|
||||
return createDbSubnetGroup(name, description, subnetIds, region, Map.of());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tags given at create are stored with the group in the same write — a live account reads
|
||||
* them back from ListTagsForResource straight after CreateDBSubnetGroup.
|
||||
*/
|
||||
public DbSubnetGroup createDbSubnetGroup(String name, String description, List<String> subnetIds,
|
||||
String region, Map<String, String> tags) {
|
||||
if (name == null || name.isBlank()) {
|
||||
throw new AwsException("MissingParameter", "The request must contain the parameter DBSubnetGroupName.", 400);
|
||||
}
|
||||
@@ -2277,6 +2286,9 @@ public class RdsService implements Resettable, ResourceProvider {
|
||||
}
|
||||
|
||||
DbSubnetGroup group = buildSubnetGroup(name, description, subnetIds, effectiveRegion);
|
||||
if (tags != null && !tags.isEmpty()) {
|
||||
group.setTags(new LinkedHashMap<>(tags));
|
||||
}
|
||||
putSubnetGroupForScope(currentAccountId(), effectiveRegion, name, group);
|
||||
return group;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user