Search in sources :

Example 66 with Parameter

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

the class TestDynamoDB method testGSI.

@Test
public void testGSI() {
    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("SortKeyName").withParameterValue("timestamp"), new Parameter().withParameterKey("Attribute1Name").withParameterValue("organisation"), new Parameter().withParameterKey("Attribute2Name").withParameterValue("category"), new Parameter().withParameterKey("Index1PartitionKeyName").withParameterValue("timestamp"), new Parameter().withParameterKey("Index2PartitionKeyName").withParameterValue("organisation"), new Parameter().withParameterKey("Index2SortKeyName").withParameterValue("category"), new Parameter().withParameterKey("BackupRetentionPeriod").withParameterValue("0"));
    // TODO how can we check if this stack works?
    } finally {
        this.deleteStack(context, stackName);
    }
}
Also used : Context(de.widdix.awscftemplates.Context) Parameter(com.amazonaws.services.cloudformation.model.Parameter) ACloudFormationTest(de.widdix.awscftemplates.ACloudFormationTest) Test(org.junit.Test)

Example 67 with Parameter

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

the class TestElastiCacheRedis method test.

@Test
public void test() {
    final Context context = new Context();
    final String vpcStackName = "vpc-2azs-" + this.random8String();
    final String clientStackName = "client-" + this.random8String();
    final String stackName = "elasticache-redis-" + this.random8String();
    try {
        this.createStack(context, vpcStackName, "vpc/vpc-2azs.yaml");
        try {
            this.createStack(context, clientStackName, "state/client-sg.yaml", new Parameter().withParameterKey("ParentVPCStack").withParameterValue(vpcStackName));
            try {
                this.createStack(context, stackName, "state/elasticache-redis.yaml", new Parameter().withParameterKey("ParentVPCStack").withParameterValue(vpcStackName), new Parameter().withParameterKey("ParentClientStack").withParameterValue(clientStackName));
            // TODO how can we check if this stack works? start a bastion host and try to connect?
            } finally {
                this.deleteStack(context, stackName);
            }
        } finally {
            this.deleteStack(context, clientStackName);
        }
    } 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 68 with Parameter

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

the class TestRDSAurora method testMySQL57.

@Test
public void testMySQL57() {
    final Context context = new Context();
    final String vpcStackName = "vpc-2azs-" + this.random8String();
    final String clientStackName = "client-" + this.random8String();
    final String stackName = "rds-aurora-" + this.random8String();
    final String password = this.random8String();
    try {
        this.createStack(context, vpcStackName, "vpc/vpc-2azs.yaml");
        try {
            this.createStack(context, clientStackName, "state/client-sg.yaml", new Parameter().withParameterKey("ParentVPCStack").withParameterValue(vpcStackName));
            try {
                this.createStack(context, stackName, "state/rds-aurora.yaml", new Parameter().withParameterKey("ParentVPCStack").withParameterValue(vpcStackName), new Parameter().withParameterKey("ParentClientStack").withParameterValue(clientStackName), new Parameter().withParameterKey("Engine").withParameterValue("aurora-mysql"), new Parameter().withParameterKey("DBName").withParameterValue("db1"), new Parameter().withParameterKey("DBMasterUserPassword").withParameterValue(password));
            // TODO how can we check if this stack works? start a bastion host and try to connect?
            } finally {
                this.deleteStack(context, stackName);
            }
        } finally {
            this.deleteStack(context, clientStackName);
        }
    } 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 69 with Parameter

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

the class TestRDSAurora method testWithSecret.

@Test
public void testWithSecret() {
    final Context context = new Context();
    final String vpcStackName = "vpc-2azs-" + this.random8String();
    final String clientStackName = "client-" + this.random8String();
    final String secretStackName = "secret-" + this.random8String();
    final String stackName = "rds-aurora-" + this.random8String();
    try {
        this.createStack(context, vpcStackName, "vpc/vpc-2azs.yaml");
        try {
            this.createStack(context, clientStackName, "state/client-sg.yaml", new Parameter().withParameterKey("ParentVPCStack").withParameterValue(vpcStackName));
            try {
                this.createStack(context, secretStackName, "state/secretsmanager-dbsecret.yaml");
                try {
                    this.createStack(context, stackName, "state/rds-aurora.yaml", new Parameter().withParameterKey("ParentVPCStack").withParameterValue(vpcStackName), new Parameter().withParameterKey("ParentClientStack").withParameterValue(clientStackName), new Parameter().withParameterKey("ParentSecretStack").withParameterValue(secretStackName), new Parameter().withParameterKey("DBName").withParameterValue("db1"));
                // TODO how can we check if this stack works? start a bastion host and try to connect?
                } finally {
                    this.deleteStack(context, stackName);
                }
            } finally {
                this.deleteStack(context, secretStackName);
            }
        } finally {
            this.deleteStack(context, clientStackName);
        }
    } 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 70 with Parameter

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

the class TestRDSAuroraServerlessPostgres method testWithSecret.

@Test
public void testWithSecret() {
    final Context context = new Context();
    final String vpcStackName = "vpc-2azs-" + this.random8String();
    final String clientStackName = "client-" + this.random8String();
    final String kmsKeyStackName = "key-" + this.random8String();
    final String secretStackName = "secret-" + this.random8String();
    final String stackName = "rds-aurora-serverless-postgres-" + this.random8String();
    try {
        this.createStack(context, vpcStackName, "vpc/vpc-2azs.yaml");
        try {
            this.createStack(context, clientStackName, "state/client-sg.yaml", new Parameter().withParameterKey("ParentVPCStack").withParameterValue(vpcStackName));
            try {
                this.createStack(context, kmsKeyStackName, "security/kms-key.yaml");
                try {
                    this.createStack(context, secretStackName, "state/secretsmanager-dbsecret.yaml");
                    try {
                        this.createStack(context, stackName, "state/rds-aurora-serverless-postgres.yaml", new Parameter().withParameterKey("ParentVPCStack").withParameterValue(vpcStackName), new Parameter().withParameterKey("ParentClientStack").withParameterValue(clientStackName), new Parameter().withParameterKey("ParentKmsKeyStack").withParameterValue(kmsKeyStackName), new Parameter().withParameterKey("ParentSecretStack").withParameterValue(secretStackName), new Parameter().withParameterKey("DBName").withParameterValue("db1"));
                    // TODO how can we check if this stack works? start a bastion host and try to connect?
                    } finally {
                        this.deleteStack(context, stackName);
                    }
                } finally {
                    this.deleteStack(context, secretStackName);
                }
            } finally {
                this.deleteStack(context, kmsKeyStackName);
            }
        } finally {
            this.deleteStack(context, clientStackName);
        }
    } 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)

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