-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bf8841e
commit f3f3991
Showing
23 changed files
with
649 additions
and
5 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>com.deliveredtechnologies</groupId> | ||
<artifactId>tf-build-tools</artifactId> | ||
<version>0.5-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>tf-s3-archetype</artifactId> | ||
<packaging>pom</packaging> | ||
|
||
<name>tf-s3-archetype</name> | ||
|
||
<build> | ||
<extensions> | ||
<extension> | ||
<groupId>org.apache.maven.archetype</groupId> | ||
<artifactId>archetype-packaging</artifactId> | ||
<version>2.4</version> | ||
</extension> | ||
</extensions> | ||
|
||
<pluginManagement> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-archetype-plugin</artifactId> | ||
<version>2.4</version> | ||
</plugin> | ||
</plugins> | ||
</pluginManagement> | ||
</build> | ||
</project> |
21 changes: 21 additions & 0 deletions
21
tf-build-tools/tf-s3-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
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 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<archetype-descriptor xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd" name="tf-s3" | ||
xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
<fileSets> | ||
<fileSet encoding="UTF-8"> | ||
<directory>src/main/tf</directory> | ||
<includes> | ||
<include>**/*.tf</include> | ||
<include>**/*.tfvars</include> | ||
<include>**/*.json</include> | ||
</includes> | ||
</fileSet> | ||
<fileSet filtered="true" packaged="true" encoding="UTF-8"> | ||
<directory>src/test/groovy</directory> | ||
<includes> | ||
<include>**/*.groovy</include> | ||
</includes> | ||
</fileSet> | ||
</fileSets> | ||
</archetype-descriptor> |
167 changes: 167 additions & 0 deletions
167
tf-build-tools/tf-s3-archetype/src/main/resources/archetype-resources/pom.xml
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,167 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<properties> | ||
<tf-maven-version>0.4-SNAPSHOT</tf-maven-version> | ||
</properties> | ||
<artifactId>${artifactId}</artifactId> | ||
<groupId>${groupId}</groupId> | ||
<version>${version}</version> | ||
<pluginRepositories> | ||
<pluginRepository> | ||
<id>sonatype</id> | ||
<url>https://oss.sonatype.org/content/repositories/snapshots/</url> | ||
</pluginRepository> | ||
</pluginRepositories> | ||
<repositories> | ||
<repository> | ||
<id>sonatype</id> | ||
<url>https://oss.sonatype.org/content/repositories/snapshots/</url> | ||
</repository> | ||
</repositories> | ||
<dependencies> | ||
<dependency> | ||
<groupId>com.deliveredtechnologies</groupId> | ||
<artifactId>tf-cmd-api</artifactId> | ||
<version>${tf-maven-version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.codehaus.groovy</groupId> | ||
<artifactId>groovy-all</artifactId> | ||
<version>2.4.7</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.spockframework</groupId> | ||
<artifactId>spock-core</artifactId> | ||
<version>1.3-groovy-2.4</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.amazonaws</groupId> | ||
<artifactId>aws-java-sdk</artifactId> | ||
<version>1.11.584</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-install-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>default-install</id> | ||
<phase>never</phase> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<!-- disables default jar packaging: https://stackoverflow.com/questions/2188746/what-is-the-best-way-to-avoid-maven-jar --> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>default-jar</id> | ||
<phase>never</phase> | ||
<configuration> | ||
<finalName>unwanted</finalName> | ||
<classifier>unwanted</classifier> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>com.deliveredtechnologies</groupId> | ||
<artifactId>tf-maven-plugin</artifactId> | ||
<version>${tf-maven-version}</version> | ||
<executions> | ||
<execution> | ||
<id>terraform-clean</id> | ||
<phase>clean</phase> | ||
<goals> | ||
<goal>clean</goal> | ||
</goals> | ||
</execution> | ||
<execution> | ||
<id>terraform-install</id> | ||
<phase>install</phase> | ||
<goals> | ||
<goal>deploy</goal> | ||
</goals> | ||
</execution> | ||
<execution> | ||
<id>terraform-package</id> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>package</goal> | ||
</goals> | ||
</execution> | ||
<execution> | ||
<id>terraform-deploy</id> | ||
<phase>deploy</phase> | ||
<goals> | ||
<goal>deploy</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-deploy-plugin</artifactId> | ||
<configuration> | ||
<skip>true</skip> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>flatten-maven-plugin</artifactId> | ||
<version>1.1.0</version> | ||
<configuration></configuration> | ||
<executions> | ||
<!-- enable flattening --> | ||
<execution> | ||
<id>flatten</id> | ||
<phase>process-resources</phase> | ||
<goals> | ||
<goal>flatten</goal> | ||
</goals> | ||
</execution> | ||
<!-- ensure proper cleanup --> | ||
<execution> | ||
<id>flatten.clean</id> | ||
<phase>clean</phase> | ||
<goals> | ||
<goal>clean</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.codehaus.gmavenplus</groupId> | ||
<artifactId>gmavenplus-plugin</artifactId> | ||
<version>1.7.0</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>addTestSources</goal> | ||
<goal>compileTests</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<configuration> | ||
<includes> | ||
<include>**/*Spec.java</include> | ||
</includes> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
24 changes: 24 additions & 0 deletions
24
...ild-tools/tf-s3-archetype/src/main/resources/archetype-resources/src/main/tf/s3/inputs.tf
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,24 @@ | ||
variable "region" { | ||
description = "region where the bucket will be created or the source region; defaults to us-east-1" | ||
type = "string" | ||
default = "us-east-1" | ||
} | ||
|
||
variable "bucket_name" { | ||
description = "name of the bucket; defaults to a 'bucket-{random id}'" | ||
type = "string" | ||
default = "" | ||
} | ||
|
||
variable "environment" { | ||
description = "value of the 'Environment' tag" | ||
type = "string" | ||
default = "dev" | ||
} | ||
|
||
variable "is_versioned" { | ||
description = "true if versioning is to be enabled, otherwise false; defaults to false" | ||
type = "string" | ||
default = false | ||
} | ||
|
40 changes: 40 additions & 0 deletions
40
tf-build-tools/tf-s3-archetype/src/main/resources/archetype-resources/src/main/tf/s3/main.tf
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,40 @@ | ||
provider "aws" { | ||
region = "${var.region}" | ||
} | ||
|
||
resource "random_id" "bucket_name" { | ||
prefix = "bucket-" | ||
byte_length = 8 | ||
} | ||
|
||
locals { | ||
bucket_name = "${length(var.bucket_name) == 0 ? random_id.bucket_name.hex : var.bucket_name}" | ||
} | ||
|
||
resource "aws_kms_key" "kmskey" { | ||
description = "This key is used to encrypt bucket objects" | ||
deletion_window_in_days = 10 | ||
} | ||
|
||
resource "aws_s3_bucket" "bucket" { | ||
bucket = "${local.bucket_name}" | ||
acl = "private" | ||
force_destroy = "true" | ||
|
||
versioning { | ||
enabled = "${var.is_versioned}" | ||
} | ||
|
||
server_side_encryption_configuration { | ||
rule { | ||
apply_server_side_encryption_by_default { | ||
kms_master_key_id = "${aws_kms_key.kmskey.arn}" | ||
sse_algorithm = "aws:kms" | ||
} | ||
} | ||
} | ||
|
||
tags = { | ||
environment = "${var.environment}" | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...ld-tools/tf-s3-archetype/src/main/resources/archetype-resources/src/main/tf/s3/outputs.tf
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,9 @@ | ||
output "bucket_arn" { | ||
description = "bucket arn" | ||
value = "${aws_s3_bucket.bucket.arn}" | ||
} | ||
|
||
output "kms_key_arn" { | ||
description = "kms key arn for the bucket encryption" | ||
value = "${aws_kms_key.kmskey.arn}" | ||
} |
2 changes: 2 additions & 0 deletions
2
...s/tf-s3-archetype/src/main/resources/archetype-resources/src/main/tf/s3/tfvars/dev.tfvars
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,2 @@ | ||
region = "us-east-2" | ||
environment = "dev" |
2 changes: 2 additions & 0 deletions
2
.../tf-s3-archetype/src/main/resources/archetype-resources/src/main/tf/s3/tfvars/test.tfvars
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,2 @@ | ||
region = "us-east-2" | ||
environment = "test" |
Oops, something went wrong.