Skip to content

Commit 11aa26a

Browse files
authored
Merge pull request #788 from marcomarasca/PLFM-9305
PLFM-9305: Parameterize Ops VPC export prefix
2 parents d4a0702 + 55e3ef6 commit 11aa26a

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

src/main/java/org/sagebionetworks/template/Constants.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ public class Constants {
7070
public static final String PROPERTY_KEY_VPC_ENDPOINTS_AZ = "org.sagebionetworks.vpc.endpoints.availability.zones";
7171
public static final String PROPERTY_KEY_VPC_PEERING_ACCEPT_ROLE_ARN = "org.sagebionetworks.vpc.peering.accept.role.arn";
7272
public static final String PROPERTY_KEY_OLD_VPC_CIDR = "org.sagebionetworks.vpc.old.vpc.cidr";
73+
public static final String PROPERTY_KEY_OPS_VPC_EXPORT_PREFIX = "org.sagebionetworks.vpc.ops.export.prefix";
74+
7375
// repo
7476
public static final String PROPERTY_KEY_STACK = "org.sagebionetworks.stack";
7577
public static final String PROPERTY_KEY_INSTANCE = "org.sagebionetworks.instance";

src/main/java/org/sagebionetworks/template/global/GlobalResourcesBuilderImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public VelocityContext createContext() {
9393
context.put(DELETION_POLICY, Constants.isProd(config.getProperty(PROPERTY_KEY_STACK)) ? DeletionPolicy.Retain.name() : DeletionPolicy.Delete.name());
9494

9595
context.put(VPC_EXPORT_PREFIX, Constants.createVpcExportPrefix(stack));
96-
context.put(OPS_VPC_EXPORT_PREFIX, "us-east-1-vpc");
96+
context.put(OPS_VPC_EXPORT_PREFIX, config.getProperty(Constants.PROPERTY_KEY_OPS_VPC_EXPORT_PREFIX));
9797
context.put(IDENTITY_ARN, stsClient.getCallerIdentity().arn());
9898

9999
return context;

src/test/java/org/sagebionetworks/template/global/GlobalResourcesBuilderImplTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import static org.sagebionetworks.template.Constants.SES_SYNAPSE_DOMAIN;
1616
import static org.sagebionetworks.template.Constants.STACK;
1717
import static org.sagebionetworks.template.Constants.VPC_EXPORT_PREFIX;
18+
import static org.sagebionetworks.template.Constants.PROPERTY_KEY_OPS_VPC_EXPORT_PREFIX;
1819

1920
import java.util.LinkedList;
2021
import java.util.List;
@@ -85,6 +86,7 @@ public void testCreateStackName() {
8586
@Test
8687
public void testCreateContext() {
8788
when(mockConfig.getProperty(PROPERTY_KEY_STACK)).thenReturn("dev");
89+
when(mockConfig.getProperty(PROPERTY_KEY_OPS_VPC_EXPORT_PREFIX)).thenReturn("us-east-1-vpc");
8890
when(mockStsClient.getCallerIdentity()).thenReturn(GetCallerIdentityResponse.builder().arn("currentIdentityArn").build());
8991
VelocityContext context = builder.createContext();
9092
assertEquals("dev", context.get(STACK));
@@ -109,6 +111,7 @@ public void testSetupSesTopics() {
109111
@Test
110112
public void testBuildGlobalResourcesDev() throws InterruptedException {
111113
when(mockConfig.getProperty(PROPERTY_KEY_STACK)).thenReturn("dev");
114+
when(mockConfig.getProperty(PROPERTY_KEY_OPS_VPC_EXPORT_PREFIX)).thenReturn("us-east-1-vpc");
112115
when(mockStsClient.getCallerIdentity()).thenReturn(GetCallerIdentityResponse.builder().arn("currentIdentityArn").build());
113116
when(mockStackTagsProvider.getStackTags(mockConfig)).thenReturn(expectedTags);
114117

@@ -137,6 +140,7 @@ public void testBuildGlobalResourcesDev() throws InterruptedException {
137140
@Test
138141
public void testBuildGlobalResourcesProd() throws InterruptedException {
139142
when(mockConfig.getProperty(PROPERTY_KEY_STACK)).thenReturn("prod");
143+
when(mockConfig.getProperty(PROPERTY_KEY_OPS_VPC_EXPORT_PREFIX)).thenReturn("us-east-1-vpc");
140144
when(mockStsClient.getCallerIdentity()).thenReturn(GetCallerIdentityResponse.builder().arn("currentIdentityArn").build());
141145
when(mockCloudFormationClientWrapper.getOutput("synapse-prod-global-resources", GLOBAL_CFSTACK_OUTPUT_KEY_SES_COMPLAINT_TOPIC)).thenReturn("complaintTopicArn");
142146
when(mockCloudFormationClientWrapper.getOutput("synapse-prod-global-resources", GLOBAL_CFSTACK_OUTPUT_KEY_SES_BOUNCE_TOPIC)).thenReturn("bounceTopicArn");

0 commit comments

Comments
 (0)