forked from widdix/aws-cf-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* first version of the new vpc templates * improved test coverage * execute tests in parallel (two at a time) * finished docs
- Loading branch information
1 parent
ab211d9
commit ad4f023
Showing
29 changed files
with
956 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Migrate from v3 to v4 | ||
|
||
There is a breaking change in the VPC layout going from v3 to v4. This change enables HA NAT Gateway/Instance (https://github.com/widdix/aws-cf-templates/issues/65). Updating your VPC can will cause connectivity interruptions in `SubnetBPrivate`, `SubnetCPrivate`, and `SubnetDPrivate` until you created new NAT Gateway/Instance for each `SubnetZone` in step 3b. | ||
|
||
> None of our templates launch workloads into private subnets that require Internet access. This could only be an issue if you use other workloads. | ||
1. Update VPC stacks with the matching updated template (`vpc/vpc-2azs.yaml`, `vpc/vpc-2azs-legacy.yaml`, `vpc/vpc-3azs.yaml`, `vpc/vpc-3azs-legacy.yaml`, `vpc/vpc-4azs.yaml`, `vpc/vpc-4azs-legacy.yaml`), leave the parameters as they are. | ||
2. Update VPC Endpoint stacks with the matching updated template (`vpc/vpc-endpoint-s3.yaml`), leave the parameters as they are. | ||
3. Update VPC NAT Gateway/Instance stacks | ||
a. Update VPC NAT Gateway/Instance stacks with the matching updated template (`vpc/vpc-nat-gateway.yaml`, `vpc/vpc-nat-instance.yaml`), set `SubnetZone` parameter to `A`. | ||
b. If you updated anything in a. create a new VPC NAT Gateway/Instance stack for each missing `SubnetZone` by setting the `SubnetZone` parameter to `B`, `C`, or `D`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
test/src/test/java/de/widdix/awscftemplates/operations/TestAlert.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package de.widdix.awscftemplates.operations; | ||
|
||
import de.widdix.awscftemplates.ACloudFormationTest; | ||
import org.junit.Test; | ||
|
||
public class TestAlert extends ACloudFormationTest { | ||
|
||
@Test | ||
public void test() { | ||
final String stackName = "alert-" + this.random8String(); | ||
try { | ||
this.createStack(stackName, | ||
"operations/alert.yaml" | ||
); | ||
// TODO how can we check if this stack works? | ||
} finally { | ||
this.deleteStack(stackName); | ||
} | ||
} | ||
|
||
} |
21 changes: 21 additions & 0 deletions
21
test/src/test/java/de/widdix/awscftemplates/security/TestAccountPasswordPolicy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package de.widdix.awscftemplates.security; | ||
|
||
import de.widdix.awscftemplates.ACloudFormationTest; | ||
import org.junit.Test; | ||
|
||
public class TestAccountPasswordPolicy extends ACloudFormationTest { | ||
|
||
@Test | ||
public void test() { | ||
final String stackName = "account-password-policy-" + this.random8String(); | ||
try { | ||
this.createStack(stackName, | ||
"security/account-password-policy.yaml" | ||
); | ||
// TODO how can we check if this stack works? | ||
} finally { | ||
this.deleteStack(stackName); | ||
} | ||
} | ||
|
||
} |
56 changes: 56 additions & 0 deletions
56
test/src/test/java/de/widdix/awscftemplates/security/TestCloudtrail.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package de.widdix.awscftemplates.security; | ||
|
||
import com.amazonaws.services.cloudformation.model.Parameter; | ||
import de.widdix.awscftemplates.ACloudFormationTest; | ||
import org.junit.Test; | ||
|
||
public class TestCloudtrail extends ACloudFormationTest { | ||
|
||
@Test | ||
public void test() { | ||
final String stackName = "cloudtrail-" + this.random8String(); | ||
final String bucketName = "cloudtrail-" + this.random8String(); | ||
final String bucketPolicy = "{\n" + | ||
" \"Version\": \"2012-10-17\",\n" + | ||
" \"Statement\": [{\n" + | ||
" \"Sid\": \"AWSCloudTrailAclCheck\",\n" + | ||
" \"Effect\": \"Allow\",\n" + | ||
" \"Principal\": {\n" + | ||
" \"Service\": \"cloudtrail.amazonaws.com\"\n" + | ||
" },\n" + | ||
" \"Action\": \"s3:GetBucketAcl\",\n" + | ||
" \"Resource\": \"arn:aws:s3:::"+ bucketName + "\"\n" + | ||
" }, {\n" + | ||
" \"Sid\": \"AWSCloudTrailWrite\",\n" + | ||
" \"Effect\": \"Allow\",\n" + | ||
" \"Principal\": {\n" + | ||
" \"Service\": \"cloudtrail.amazonaws.com\"\n" + | ||
" },\n" + | ||
" \"Action\": \"s3:PutObject\",\n" + | ||
" \"Resource\": [\n" + | ||
" \"arn:aws:s3:::"+ bucketName + "/AWSLogs/" + this.getAccount() + "/*\"\n" + | ||
" ],\n" + | ||
" \"Condition\": {\n" + | ||
" \"StringEquals\": {\n" + | ||
" \"s3:x-amz-acl\": \"bucket-owner-full-control\"\n" + | ||
" }\n" + | ||
" }\n" + | ||
" }]\n" + | ||
"}"; | ||
try { | ||
this.createBucket(bucketName, bucketPolicy); | ||
try { | ||
this.createStack(stackName, | ||
"security/cloudtrail.yaml", | ||
new Parameter().withParameterKey("ExternalTrailBucket").withParameterValue(bucketName) | ||
); | ||
// TODO how can we check if this stack works? | ||
} finally { | ||
this.deleteStack(stackName); | ||
} | ||
} finally { | ||
this.deleteBucket(bucketName); | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.