use of com.amazonaws.services.cloudformation.model.Parameter in project aws-cf-templates by widdix.
the class TestVPC4AZsLegacy method test.
@Test
public void test() {
final Context context = new Context();
final String vpcStackName = "vpc-4azs-" + this.random8String();
final String stackName = "vpc-4azs-legacy-" + this.random8String();
try {
this.createStack(context, vpcStackName, "vpc/vpc-4azs.yaml", new Parameter().withParameterKey("ClassB").withParameterValue("10"));
final Map<String, String> vpcOutputs = this.getStackOutputs(vpcStackName);
try {
this.createStack(context, stackName, "vpc/vpc-4azs-legacy.yaml", new Parameter().withParameterKey("AZA").withParameterValue(vpcOutputs.get("AZA")), new Parameter().withParameterKey("AZB").withParameterValue(vpcOutputs.get("AZB")), new Parameter().withParameterKey("AZC").withParameterValue(vpcOutputs.get("AZC")), new Parameter().withParameterKey("AZD").withParameterValue(vpcOutputs.get("AZD")), new Parameter().withParameterKey("CidrBlock").withParameterValue(vpcOutputs.get("CidrBlock")), new Parameter().withParameterKey("CidrBlockIPv6").withParameterValue(vpcOutputs.get("CidrBlockIPv6")), new Parameter().withParameterKey("VPC").withParameterValue(vpcOutputs.get("VPC")), new Parameter().withParameterKey("InternetGateway").withParameterValue(vpcOutputs.get("InternetGateway")), new Parameter().withParameterKey("SubnetAPublic").withParameterValue(vpcOutputs.get("SubnetAPublic")), new Parameter().withParameterKey("RouteTableAPublic").withParameterValue(vpcOutputs.get("RouteTableAPublic")), new Parameter().withParameterKey("SubnetBPublic").withParameterValue(vpcOutputs.get("SubnetBPublic")), new Parameter().withParameterKey("RouteTableBPublic").withParameterValue(vpcOutputs.get("RouteTableBPublic")), new Parameter().withParameterKey("SubnetCPublic").withParameterValue(vpcOutputs.get("SubnetCPublic")), new Parameter().withParameterKey("RouteTableCPublic").withParameterValue(vpcOutputs.get("RouteTableCPublic")), new Parameter().withParameterKey("SubnetDPublic").withParameterValue(vpcOutputs.get("SubnetDPublic")), new Parameter().withParameterKey("RouteTableDPublic").withParameterValue(vpcOutputs.get("RouteTableDPublic")), new Parameter().withParameterKey("SubnetAPrivate").withParameterValue(vpcOutputs.get("SubnetAPrivate")), new Parameter().withParameterKey("RouteTableAPrivate").withParameterValue(vpcOutputs.get("RouteTableAPrivate")), new Parameter().withParameterKey("SubnetBPrivate").withParameterValue(vpcOutputs.get("SubnetBPrivate")), new Parameter().withParameterKey("RouteTableBPrivate").withParameterValue(vpcOutputs.get("RouteTableBPrivate")), new Parameter().withParameterKey("SubnetCPrivate").withParameterValue(vpcOutputs.get("SubnetCPrivate")), new Parameter().withParameterKey("RouteTableCPrivate").withParameterValue(vpcOutputs.get("RouteTableCPrivate")), new Parameter().withParameterKey("SubnetDPrivate").withParameterValue(vpcOutputs.get("SubnetDPrivate")), new Parameter().withParameterKey("RouteTableDPrivate").withParameterValue(vpcOutputs.get("RouteTableDPrivate")));
this.testVPCSubnetInternetAccess(context, stackName, "SubnetAPublic");
this.testVPCSubnetInternetAccess(context, stackName, "SubnetBPublic");
this.testVPCSubnetInternetAccess(context, stackName, "SubnetCPublic");
this.testVPCSubnetInternetAccess(context, stackName, "SubnetDPublic");
} finally {
this.deleteStack(context, stackName);
}
} finally {
this.deleteStack(context, vpcStackName);
}
}
use of com.amazonaws.services.cloudformation.model.Parameter in project aws-cf-templates by widdix.
the class TestVPCEndpointS3 method test.
@Test
public void test() {
final Context context = new Context();
final String vpcStackName = "vpc-2azs-" + this.random8String();
final String endpointStackName = "vpc-endpoint-s3-" + this.random8String();
final String classB = "10";
try {
this.createStack(context, vpcStackName, "vpc/vpc-2azs.yaml", new Parameter().withParameterKey("ClassB").withParameterValue(classB));
try {
this.createStack(context, endpointStackName, "vpc/vpc-endpoint-s3.yaml", new Parameter().withParameterKey("ParentVPCStack").withParameterValue(vpcStackName));
// TODO how can we check if this stack works?
} finally {
this.deleteStack(context, endpointStackName);
}
} finally {
this.deleteStack(context, vpcStackName);
}
}
use of com.amazonaws.services.cloudformation.model.Parameter in project aws-cf-templates by widdix.
the class TestVPCFlowLogsS3 method test.
@Test
public void test() {
final Context context = new Context();
final String vpcStackName = "vpc-2azs-" + this.random8String();
final String flowLogsStackName = "vpc-flow-logs-s3-" + this.random8String();
final String classB = "10";
try {
this.createStack(context, vpcStackName, "vpc/vpc-2azs.yaml", new Parameter().withParameterKey("ClassB").withParameterValue(classB));
try {
this.createStack(context, flowLogsStackName, "vpc/vpc-flow-logs-s3.yaml", new Parameter().withParameterKey("ParentVPCStack").withParameterValue(vpcStackName));
// TODO how can we check if this stack works?
this.emptyBucket(context, this.getStackOutputValue(flowLogsStackName, "LogBucketName"));
} finally {
this.deleteStack(context, flowLogsStackName);
}
} finally {
this.deleteStack(context, vpcStackName);
}
}
use of com.amazonaws.services.cloudformation.model.Parameter in project aws-cf-templates by widdix.
the class TestSecurityAuthProxy method testHAGitHubOrga.
@Test
public void testHAGitHubOrga() {
final Context context = new Context();
final String zoneStackName = "zone-" + this.random8String();
final String vpcStackName = "vpc-2azs-" + this.random8String();
final String stackName = "auth-proxy-ha-github-orga-" + this.random8String();
final String classB = "10";
final String keyName = "key-" + this.random8String();
final String subDomainName = stackName;
try {
this.createKey(keyName);
try {
this.createStack(context, zoneStackName, "vpc/zone-legacy.yaml", new Parameter().withParameterKey("HostedZoneName").withParameterValue(Config.get(Config.Key.DOMAIN_SUFFIX)), new Parameter().withParameterKey("HostedZoneId").withParameterValue(Config.get(Config.Key.HOSTED_ZONE_ID)));
try {
this.createStack(context, vpcStackName, "vpc/vpc-2azs.yaml", new Parameter().withParameterKey("ClassB").withParameterValue(classB));
try {
this.createStack(context, stackName, "security/auth-proxy-ha-github-orga.yaml", new Parameter().withParameterKey("ParentVPCStack").withParameterValue(vpcStackName), new Parameter().withParameterKey("ParentZoneStack").withParameterValue(zoneStackName), new Parameter().withParameterKey("CertificateArn").withParameterValue(Config.get(Config.Key.ACM_CERTIFICATE_ARN)), new Parameter().withParameterKey("KeyName").withParameterValue(keyName), // fake value
new Parameter().withParameterKey("GitHubOrganization").withParameterValue("widdix"), // fake value
new Parameter().withParameterKey("GitHubClientId").withParameterValue("2bb8ab97cb147fa499f6"), // fake value
new Parameter().withParameterKey("GitHubClientSecret").withParameterValue("d3a1a8a9b6525fb0599d22fc750f17ef76032c62"), new Parameter().withParameterKey("Upstream").withParameterValue("https://widdix.net/"), // fake value
new Parameter().withParameterKey("CookieSecret").withParameterValue("ylLjZRVNRlzW7sqyQeERBQ=="), new Parameter().withParameterKey("SubDomainNameWithDot").withParameterValue(subDomainName + "."));
final String url = "https://" + subDomainName + "." + Config.get(Config.Key.DOMAIN_SUFFIX);
final Callable<String> callable = () -> {
final HttpResponse response = WS.url(url).timeout(10000).get();
// check HTTP response code
if (WS.getStatus(response) != 403) {
throw new RuntimeException("403 expected, but saw " + WS.getStatus(response));
}
return WS.getResponseAsString(response);
};
final String response = this.retry(context, callable);
// check if OAuth2 Proxy appears in HTML
Assert.assertTrue("http response body contains \"OAuth2 Proxy\"", response.contains("OAuth2 Proxy"));
} finally {
this.deleteStack(context, stackName);
}
} finally {
this.deleteStack(context, vpcStackName);
}
} finally {
this.deleteStack(context, zoneStackName);
}
} finally {
this.deleteKey(context, keyName);
}
}
use of com.amazonaws.services.cloudformation.model.Parameter in project aws-cf-templates by widdix.
the class TestDynamoDB method test.
@Test
public void test() {
final Context context = new Context();
final String stackName = "dynamodb-" + this.random8String();
try {
this.createStack(context, stackName, "state/dynamodb.yaml", new Parameter().withParameterKey("PartitionKeyName").withParameterValue("id"), new Parameter().withParameterKey("BackupRetentionPeriod").withParameterValue("0"));
// TODO how can we check if this stack works?
} finally {
this.deleteStack(context, stackName);
}
}
Aggregations