mirror of
https://github.com/floci-io/floci.git
synced 2026-11-22 21:50:46 -05:00
fix(cloudformation): preserve subnet public IP setting (#2031)
This commit is contained in:
1 parent
c0522593e5
commit
b62d1e762e
2 files changed
+9
-1
No files matched your search
+4
@@ -587,7 +587,11 @@ public class CloudFormationResourceProvisioner {
|
||||
String vpcId = resolveOptional(props, "VpcId", engine);
|
||||
String cidr = resolveOptional(props, "CidrBlock", engine);
|
||||
String az = resolveOptional(props, "AvailabilityZone", engine);
|
||||
String mapPublicIpOnLaunch = resolveOptional(props, "MapPublicIpOnLaunch", engine);
|
||||
var subnet = ec2Service.createSubnet(region, vpcId, cidr, az);
|
||||
if (mapPublicIpOnLaunch != null) {
|
||||
ec2Service.modifySubnetAttribute(region, subnet.getSubnetId(), "mapPublicIpOnLaunch", mapPublicIpOnLaunch);
|
||||
}
|
||||
r.setPhysicalId(subnet.getSubnetId());
|
||||
r.getAttributes().put("SubnetId", subnet.getSubnetId());
|
||||
r.getAttributes().put("VpcId", subnet.getVpcId());
|
||||
|
||||
+5
-1
@@ -10,6 +10,7 @@ import java.util.regex.Pattern;
|
||||
|
||||
import static io.restassured.RestAssured.given;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
@@ -48,7 +49,8 @@ class CloudFormationEc2IntegrationTest {
|
||||
"Properties": {
|
||||
"VpcId": {"Ref": "Vpc"},
|
||||
"CidrBlock": "10.0.1.0/24",
|
||||
"AvailabilityZone": "ap-southeast-2a"
|
||||
"AvailabilityZone": "ap-southeast-2a",
|
||||
"MapPublicIpOnLaunch": true
|
||||
}
|
||||
},
|
||||
"Subnet2": {
|
||||
@@ -107,6 +109,8 @@ class CloudFormationEc2IntegrationTest {
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body("DescribeSubnetsResponse.subnetSet.item.find { it.availabilityZone == 'ap-southeast-2a' }.mapPublicIpOnLaunch",
|
||||
equalTo("true"))
|
||||
.extract().asString();
|
||||
|
||||
for (String subnetId : exportedSubnetIds) {
|
||||
|
||||
Reference in new issue
Block a user