mirror of
https://github.com/floci-io/floci.git
synced 2026-11-27 15:49:33 -05:00
fix(ec2): propagate transit gateway attachments to the default propagation route table (#7060)
* fix(ec2): propagate transit gateway attachments to the default propagation route table * refactor(ec2): build transit gateway route table propagations in one helper The default-propagation path in storeNewAttachment and enableTransitGatewayRouteTablePropagation built the same propagation record field for field. Both now call storePropagation. * test(ec2): assert the resource id of a default-created propagation The create-site VPC id argument to the propagation helper was not checked by any test; only the resource type was.
This commit is contained in:
1 parent
b3dad93daf
commit
3b4a2ec14d
3 files changed
+132
-11
No files matched your search
@@ -2715,9 +2715,28 @@ public class Ec2Service implements ContainerTeardown, ResourceProvider, Resettab
|
||||
putTags(region, attachmentId, new ArrayList<>(attachmentTags));
|
||||
}
|
||||
transitGatewayVpcAttachments.put(key(region, attachmentId), attachment);
|
||||
String propagationTableId = gateway.getOptions().getPropagationDefaultRouteTableId();
|
||||
if ("enable".equals(gateway.getOptions().getDefaultRouteTablePropagation()) && propagationTableId != null) {
|
||||
storePropagation(region, propagationTableId, attachmentId, vpcId);
|
||||
}
|
||||
return attachment;
|
||||
}
|
||||
|
||||
private TransitGatewayRouteTablePropagation storePropagation(
|
||||
String region, String routeTableId, String attachmentId, String vpcId) {
|
||||
TransitGatewayRouteTablePropagation propagation = new TransitGatewayRouteTablePropagation();
|
||||
propagation.setTransitGatewayRouteTableId(routeTableId);
|
||||
propagation.setTransitGatewayAttachmentId(attachmentId);
|
||||
propagation.setResourceId(vpcId);
|
||||
propagation.setResourceType("vpc");
|
||||
// Verified live: propagation reports the settled state at once, where association
|
||||
// reports associating first.
|
||||
propagation.setState("enabled");
|
||||
propagation.setRegion(region);
|
||||
transitGatewayPropagations.put(propagationKey(region, routeTableId, attachmentId), propagation);
|
||||
return propagation;
|
||||
}
|
||||
|
||||
/**
|
||||
* One region-wide monitor for every operation that creates an attachment, removes one, or
|
||||
* removes something an attachment depends on. Held outermost wherever a gateway lock is also
|
||||
@@ -3301,17 +3320,7 @@ public class Ec2Service implements ContainerTeardown, ResourceProvider, Resettab
|
||||
throw new AwsException("TransitGatewayRouteTablePropagation.Duplicate", "Propagation "
|
||||
+ attachmentId + " already exists in Transit Gateway Route Table " + routeTableId + ".", 400);
|
||||
}
|
||||
TransitGatewayRouteTablePropagation propagation = new TransitGatewayRouteTablePropagation();
|
||||
propagation.setTransitGatewayRouteTableId(routeTableId);
|
||||
propagation.setTransitGatewayAttachmentId(attachmentId);
|
||||
propagation.setResourceId(attachment.getVpcId());
|
||||
propagation.setResourceType("vpc");
|
||||
// Verified live: propagation reports the settled state at once, where association
|
||||
// reports associating first.
|
||||
propagation.setState("enabled");
|
||||
propagation.setRegion(region);
|
||||
transitGatewayPropagations.put(propagationKey(region, routeTableId, attachmentId), propagation);
|
||||
return propagation;
|
||||
return storePropagation(region, routeTableId, attachmentId, attachment.getVpcId());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user