Search in sources :

Example 31 with Parameter

use of com.amazonaws.services.cloudformation.model.Parameter in project aws-cf-templates by widdix.

the class AVPCTest method testVPCSubnetInternetAccess.

protected final void testVPCSubnetInternetAccess(final Context context, final String parentVPCStack, final String subnetName) {
    final String reach = subnetName.endsWith("Private") ? "private" : "public";
    final String stackName = "al2-mutable-" + reach + "-" + this.random8String();
    try {
        this.createStack(context, stackName, "ec2/al2-mutable-" + reach + ".yaml", new Parameter().withParameterKey("ParentVPCStack").withParameterValue(parentVPCStack), new Parameter().withParameterKey("SubnetName").withParameterValue(subnetName));
    } finally {
        this.deleteStack(context, stackName);
    }
}
Also used : Parameter(com.amazonaws.services.cloudformation.model.Parameter)

Example 32 with Parameter

use of com.amazonaws.services.cloudformation.model.Parameter in project aws-cf-templates by widdix.

the class TestVPC3AZs method test.

@Test
public void test() {
    final Context context = new Context();
    final String stackName = "vpc-3azs-" + this.random8String();
    try {
        this.createStack(context, stackName, "vpc/vpc-3azs.yaml", new Parameter().withParameterKey("ClassB").withParameterValue("10"));
        this.testVPCSubnetInternetAccess(context, stackName, "SubnetAPublic");
        this.testVPCSubnetInternetAccess(context, stackName, "SubnetBPublic");
        this.testVPCSubnetInternetAccess(context, stackName, "SubnetCPublic");
    } finally {
        this.deleteStack(context, stackName);
    }
}
Also used : Context(de.widdix.awscftemplates.Context) Parameter(com.amazonaws.services.cloudformation.model.Parameter) Test(org.junit.Test)

Example 33 with Parameter

use of com.amazonaws.services.cloudformation.model.Parameter in project aws-cf-templates by widdix.

the class TestVPC4AZs method test.

@Test
public void test() {
    final Context context = new Context();
    final String stackName = "vpc-4azs-" + this.random8String();
    try {
        this.createStack(context, stackName, "vpc/vpc-4azs.yaml", new Parameter().withParameterKey("ClassB").withParameterValue("10"));
        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);
    }
}
Also used : Context(de.widdix.awscftemplates.Context) Parameter(com.amazonaws.services.cloudformation.model.Parameter) Test(org.junit.Test)

Example 34 with Parameter

use of com.amazonaws.services.cloudformation.model.Parameter in project aws-cf-templates by widdix.

the class TestVPCEndpointDynamoDB method test.

@Test
public void test() {
    final Context context = new Context();
    final String vpcStackName = "vpc-2azs-" + this.random8String();
    final String endpointStackName = "vpc-endpoint-dynamodb-" + 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-dynamodb.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);
    }
}
Also used : Context(de.widdix.awscftemplates.Context) Parameter(com.amazonaws.services.cloudformation.model.Parameter) ACloudFormationTest(de.widdix.awscftemplates.ACloudFormationTest) Test(org.junit.Test)

Example 35 with Parameter

use of com.amazonaws.services.cloudformation.model.Parameter in project aws-cf-templates by widdix.

the class TestHostedZone method testDNSSEC.

@Test
public void testDNSSEC() {
    final Context context = new Context();
    final String keyStackName = "key-" + this.random8String();
    final String zoneStackName = "hostedzone-" + this.random8String();
    final String dnssecStackName = "dnssec-" + this.random8String();
    try {
        this.createStack(context, keyStackName, "security/kms-key.yaml", new Parameter().withParameterKey("Service").withParameterValue("dnssec-route53"), new Parameter().withParameterKey("KeySpec").withParameterValue("ECC_NIST_P256"), new Parameter().withParameterKey("KeyUsage").withParameterValue("SIGN_VERIFY"));
        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, dnssecStackName, "vpc/zone-dnssec.yaml", new Parameter().withParameterKey("ParentZoneStack").withParameterValue(zoneStackName), new Parameter().withParameterKey("ParentKmsKeyStack").withParameterValue(keyStackName));
            } finally {
                this.deleteStack(context, dnssecStackName);
            }
        } finally {
            this.deleteStack(context, zoneStackName);
        }
    } finally {
        this.deleteStack(context, keyStackName);
    }
}
Also used : Context(de.widdix.awscftemplates.Context) Parameter(com.amazonaws.services.cloudformation.model.Parameter) ACloudFormationTest(de.widdix.awscftemplates.ACloudFormationTest) Test(org.junit.Test)

Aggregations

Parameter (com.amazonaws.services.cloudformation.model.Parameter)85 Test (org.junit.Test)79 Context (de.widdix.awscftemplates.Context)66 ACloudFormationTest (de.widdix.awscftemplates.ACloudFormationTest)60 HttpResponse (org.apache.http.HttpResponse)19 KeyPair (com.amazonaws.services.ec2.model.KeyPair)5 StringInputStream (com.amazonaws.util.StringInputStream)4 ArrayList (java.util.ArrayList)4 DescribeContainerInstancesRequest (com.amazonaws.services.ecs.model.DescribeContainerInstancesRequest)3 DescribeContainerInstancesResult (com.amazonaws.services.ecs.model.DescribeContainerInstancesResult)3 ListContainerInstancesRequest (com.amazonaws.services.ecs.model.ListContainerInstancesRequest)3 ListContainerInstancesResult (com.amazonaws.services.ecs.model.ListContainerInstancesResult)3 ParameterProvider (de.taimos.pipeline.aws.cloudformation.ParameterProvider)3 FilePath (hudson.FilePath)3 AmazonCloudFormation (com.amazonaws.services.cloudformation.AmazonCloudFormation)2 TaskListener (hudson.model.TaskListener)2 CpsFlowDefinition (org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition)2 WorkflowJob (org.jenkinsci.plugins.workflow.job.WorkflowJob)2 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)2 Change (com.amazonaws.services.cloudformation.model.Change)1