Skip to content

Commit

Permalink
released v0.8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Clayton7510 committed Mar 3, 2020
1 parent b537e7f commit b7b4eb5
Show file tree
Hide file tree
Showing 30 changed files with 221 additions and 281 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -8,3 +8,4 @@ target
.terraform
.gpg
.flattened-pom.xml
.DS_Store
2 changes: 2 additions & 0 deletions .travis.yml
Expand Up @@ -27,6 +27,8 @@ script:
if [ $TRAVIS_PULL_REQUEST = "false" ] && echo $VERSION | grep -q SNAPSHOT; then
echo "*** Validating the build and deploying to Sonatype's SNAPSHOT repo ***"
cp ../.mvn.settings.xml $HOME/.m2/settings.xml && ./mvnw clean test coveralls:report deploy
echo "*** Deploying the tf-s3-archetype to Sonatype's SNAPSHOT repo ***"
cd ../tf-s3-archetype && ./mvnw clean deploy
else
echo "*** Validating the build ***"
./mvnw clean test coveralls:report
Expand Down
80 changes: 42 additions & 38 deletions README.md
@@ -1,10 +1,10 @@
[tf-maven-plugin]:https://search.maven.org/artifact/com.deliveredtechnologies/tf-maven-plugin/0.7.3/maven-plugin
[tf-cmd-api]:https://search.maven.org/artifact/com.deliveredtechnologies/tf-cmd-api/0.7.3/jar
[tf-s3-archetype]:https://search.maven.org/artifact/com.deliveredtechnologies/tf-s3-archetype/0.7.3/jar
[tf-maven-plugin]:https://search.maven.org/artifact/com.deliveredtechnologies/tf-maven-plugin/0.8.1/maven-plugin
[tf-cmd-api]:https://search.maven.org/artifact/com.deliveredtechnologies/tf-cmd-api/0.8.1/jar
[tf-s3-archetype]:https://search.maven.org/artifact/com.deliveredtechnologies/tf-s3-archetype/0.8.1/jar
[tf-maven-plugin-snapshot]:https://oss.sonatype.org/content/repositories/snapshots/com/deliveredtechnologies/tf-maven-plugin/
[tf-cmd-api-snapshot]:https://oss.sonatype.org/content/repositories/snapshots/com/deliveredtechnologies/tf-cmd-api/
[tf-s3-archetype-snapshot]:https://oss.sonatype.org/content/repositories/snapshots/com/deliveredtechnologies/tf-s3-archetype/
[maven-badge]:https://img.shields.io/badge/maven%20central-0.7.3-green.svg
[maven-badge]:https://img.shields.io/badge/maven%20central-0.8.1-green.svg
[maven-snapshot-badge]:https://img.shields.io/badge/SNAPSHOT-0.8-green.svg
[tf-maven-plugin-synk-badge]:https://img.shields.io/badge/vulnerabilities-1-yellow.svg
[tf-maven-plugin-synk]:https://snyk.io/test/github/deliveredtechnologies/terraform-maven?targetFile=tf-build-tools%2Ftf-maven-plugin%2Fpom.xml
Expand Down Expand Up @@ -138,6 +138,7 @@ Optional Parameters:
| backendConfig | String | A comma delimited string of optional backend config (e.g. backendConfig="region=us-east-1,bucket=mybucket,key=/some/path") |
| verifyPlugins | Boolean | Skips release signature validation when installing downloaded plugins (not recommended) |
| skipTfGet | Boolean | If set to true, tf:init is done without running tf:get |
| artifact | String | Supplied in form {groupId}:{artifactId}:{versionId}; if present, the maven artifact is treated like a root module |

---

Expand All @@ -149,21 +150,22 @@ Executes the `terraform plan` command. See [https://www.terraform.io/docs/comman

Optional Parameters:

| Name | Type | Description |
| -------------- | ------- | ---------------------------------------------------------------------------------------------------------- |
| tfVarFiles | String | A comma delimited string of tfvars files (e.g. -var-file=foo) |
| tfVars | String | A comma delimited string of tfvars (e.g. -var 'name=value') |
| lockTimeout | Number | Duration to retry a state lock |
| target | Number | A resource address to target |
| planInput | Boolean | If set to "true", input variables not directly set will be requested; otherwise, the plan will fail |
| noColor | Any | If this property exists, the -no-color flag is set |
| destroyPlan | Any | If this property exists, a destroy plan is outputted |
| planOutputFile | String | The path to save the generated execution plan |
| tfRootDir | String | A terraform config directory to apply; defaults to `src/main/tf/{first dir found}`, then current directory |
| timeout | Number | The maximum time in milliseconds that the terraform apply command can run; defaults to 10min |
| refreshState | Boolean | If set to "true" then Terraform will refresh the state before generating the plan |
| tfState | String | The path to the state file; defaults to `terraform.tfstate` |

| Name | Type | Description |
| -------------- | ------- | ----------------------------------------------------------------------------------------------------------------- |
| tfVarFiles | String | A comma delimited string of tfvars files (e.g. -var-file=foo) |
| tfVars | String | A comma delimited string of tfvars (e.g. -var 'name=value') |
| lockTimeout | Number | Duration to retry a state lock |
| target | Number | A resource address to target |
| planInput | Boolean | If set to "true", input variables not directly set will be requested; otherwise, the plan will fail |
| noColor | Any | If this property exists, the -no-color flag is set |
| destroyPlan | Any | If this property exists, a destroy plan is outputted |
| planOutputFile | String | The path to save the generated execution plan |
| tfRootDir | String | A terraform config directory to apply; defaults to `src/main/tf/{first dir found}`, then current directory |
| timeout | Number | The maximum time in milliseconds that the terraform apply command can run; defaults to 10min |
| refreshState | Boolean | If set to "true" then Terraform will refresh the state before generating the plan |
| tfState | String | The path to the state file; defaults to `terraform.tfstate` |
| artifact | String | Supplied in form {groupId}:{artifactId}:{versionId}; if present, the maven artifact is treated like a root module |

---

#### tf:apply
Expand All @@ -174,16 +176,17 @@ Executes the `terraform apply` command. See [https://www.terraform.io/docs/comma

Optional Parameters:

| Name | Type | Description |
| ----------- | ------ | ---------------------------------------------------------------------------------------------------------- |
| tfVarFiles | String | A comma delimited string of tfvars files (e.g. -var-file=foo) |
| tfVars | String | A comma delimited string of tfvars (e.g. -var 'name=value') |
| lockTimeout | Number | Duration to retry a state lock |
| target | Number | A resource address to target |
| noColor | Any | If this property exists, the -no-color flag is set |
| plan | String | A terraform plan to apply; if both plan and tfRootDir are specified, only plan is used |
| tfRootDir | String | A terraform config directory to apply; defaults to `src/main/tf/{first dir found}`, then current directory |
| timeout | Number | The maximum time in milliseconds that the terraform apply command can run; defaults to 10min |
| Name | Type | Description |
| ----------- | ------ | ------------------------------------------------------------------------------------------------------------------ |
| tfVarFiles | String | A comma delimited string of tfvars files (e.g. -var-file=foo) |
| tfVars | String | A comma delimited string of tfvars (e.g. -var 'name=value') |
| lockTimeout | Number | Duration to retry a state lock |
| target | Number | A resource address to target |
| noColor | Any | If this property exists, the -no-color flag is set |
| plan | String | A terraform plan to apply; if both plan and tfRootDir are specified, only plan is used |
| tfRootDir | String | A terraform config directory to apply; defaults to `src/main/tf/{first dir found}`, then current directory |
| timeout | Number | The maximum time in milliseconds that the terraform apply command can run; defaults to 10min |
| artifact | String | Supplied in form {groupId}:{artifactId}:{versionId}; if present, the maven artifact is treated like a root module |

---

Expand All @@ -195,15 +198,16 @@ Executes the `terraform destroy` command. See [https://www.terraform.io/docs/com

Optional Parameters:

| Name | Type | Description |
| ----------- | ------ | ---------------------------------------------------------------------------------------------- |
| lockTimeout | Number | Duration to retry a state lock |
| tfVarFiles | String | A comma delimited string of tfvars files (e.g. -var-file=foo) |
| tfVars | String | A comma delimited string of tfvars (e.g. -var 'name=value') |
| target | Number | A resource address to target |
| noColor | Any | If this property exists, the -no-color flag is set |
| tfRootDir | String | A terraform config directory to destroy; defaults to current directory |
| timeout | Number | The maximum time in milliseconds that the terraform destroy command can run; defaults to 10min |
| Name | Type | Description |
| ----------- | ------ | ------------------------------------------------------------------------------------------------------------------ |
| lockTimeout | Number | Duration to retry a state lock |
| tfVarFiles | String | A comma delimited string of tfvars files (e.g. -var-file=foo) |
| tfVars | String | A comma delimited string of tfvars (e.g. -var 'name=value') |
| target | Number | A resource address to target |
| noColor | Any | If this property exists, the -no-color flag is set |
| tfRootDir | String | A terraform config directory to destroy; defaults to current directory |
| timeout | Number | The maximum time in milliseconds that the terraform destroy command can run; defaults to 10min |
| artifact | String | Supplied in form {groupId}:{artifactId}:{versionId}; if present, the maven artifact is treated like a root module |

---

Expand Down
2 changes: 1 addition & 1 deletion examples/tf-s3-consumer/pom.xml
Expand Up @@ -4,7 +4,7 @@
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.8-SNAPSHOT</tf-maven-version>
<tf-maven-version>0.8</tf-maven-version>
</properties>
<artifactId>tf-s3-consumer</artifactId>
<groupId>com.deliveredtechnologies.example.maven.tf</groupId>
Expand Down
2 changes: 2 additions & 0 deletions examples/tf-s3-consumer/src/main/tf/root/tfvars/dev.tfvars
@@ -0,0 +1,2 @@
region = "us-east-2"
environment = "dev"
2 changes: 2 additions & 0 deletions examples/tf-s3-consumer/src/main/tf/root/tfvars/test.tfvars
@@ -0,0 +1,2 @@
region = "us-east-2"
environment = "test"
2 changes: 1 addition & 1 deletion examples/tf-s3/pom.xml
Expand Up @@ -4,7 +4,7 @@
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.8-SNAPSHOT</tf-maven-version>
<tf-maven-version>0.8</tf-maven-version>
</properties>
<artifactId>tf-s3</artifactId>
<groupId>com.deliveredtechnologies.example.maven.tf</groupId>
Expand Down
2 changes: 1 addition & 1 deletion tf-build-tools/pom.xml
Expand Up @@ -6,7 +6,7 @@
<groupId>com.deliveredtechnologies</groupId>
<artifactId>tf-build-tools</artifactId>
<packaging>pom</packaging>
<version>0.8-SNAPSHOT</version>
<version>0.8.1</version>
<description>Terraform Build Tools: The parent POM project for Java and Terraform Tools</description>
<modules>
<module>tf-cmd-api</module>
Expand Down
2 changes: 1 addition & 1 deletion tf-build-tools/tf-cmd-api/pom.xml
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>tf-build-tools</artifactId>
<groupId>com.deliveredtechnologies</groupId>
<version>0.8-SNAPSHOT</version>
<version>0.8.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>tf-cmd-api</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion tf-build-tools/tf-maven-plugin/pom.xml
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.deliveredtechnologies</groupId>
<artifactId>tf-build-tools</artifactId>
<version>0.8-SNAPSHOT</version>
<version>0.8.1</version>
</parent>
<artifactId>tf-maven-plugin</artifactId>
<packaging>maven-plugin</packaging>
Expand Down
Expand Up @@ -12,6 +12,7 @@
import org.apache.maven.shared.invoker.Invoker;
import org.apache.maven.shared.invoker.MavenInvocationException;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
Expand Down Expand Up @@ -104,8 +105,11 @@ final void getArtifactFromMavenRepo(Invoker invoker, InvocationRequest request)
Optional<Path> pomFile = Files.walk(workingPath)
.filter(path -> path.getFileName().toString().endsWith(".pom"))
.findFirst();

if (pomFile.isPresent()) {
FileUtils.moveFile(pomFile.get().toFile(), workingPath.resolve("pom.xml").toFile());
File workingFile = workingPath.resolve("pom.xml").toFile();
if (workingFile.exists()) workingFile.delete();
FileUtils.moveFile(pomFile.get().toFile(), workingFile);
}

} catch (MavenInvocationException | IOException e) {
Expand Down
Expand Up @@ -17,7 +17,7 @@
* <br>
* Runs 'terraform apply'
*/
@Mojo(name = "apply")
@Mojo(name = "apply", requiresProject = false)
public class Apply extends TerraformMojo<String> {
@Parameter(property = "tfRootDir")
String tfRootDir;
Expand Down
Expand Up @@ -17,7 +17,7 @@
* <br>
* Runs 'terraform destroy'
*/
@Mojo(name = "destroy")
@Mojo(name = "destroy", requiresProject = false)
public class Destroy extends TerraformMojo<String> {
@Parameter(property = "tfRootDir")
String tfRootDir;
Expand Down
Expand Up @@ -8,7 +8,6 @@
import org.apache.commons.lang3.StringUtils;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Execute;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;

Expand All @@ -19,8 +18,7 @@
* <br>
* Runs 'terraform init'
*/
@Execute(goal = "get")
@Mojo(name = "init")
@Mojo(name = "init", requiresProject = false)
public class Init extends TerraformMojo<String> {
@Parameter(property = "tfRootDir")
String tfRootDir;
Expand Down
Expand Up @@ -17,7 +17,7 @@
* <br>
* Runs 'terraform plan'
*/
@Mojo(name = "plan")
@Mojo(name = "plan", requiresProject = false)
public class Plan extends TerraformMojo<String> {
@Parameter(property = "tfRootDir")
String tfRootDir;
Expand Down
6 changes: 6 additions & 0 deletions tf-build-tools/tf-maven-plugin/src/main/tf/other/main.tf
@@ -0,0 +1,6 @@
#An empty main.terraform for testing

module "test-module" {
source = "../../tfmodules/test-module"
something = "test"
}
6 changes: 6 additions & 0 deletions tf-build-tools/tf-maven-plugin/src/main/tf/root/main.tf
@@ -0,0 +1,6 @@
#An empty main.terraform for testing

module "test-module" {
source = "../../tfmodules/test-module"
something = "test"
}
2 changes: 1 addition & 1 deletion tf-build-tools/tf-s3-archetype/pom.xml
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.deliveredtechnologies</groupId>
<version>0.8-SNAPSHOT</version>
<version>0.8.1</version>
<artifactId>tf-build-tools</artifactId>
</parent>
<artifactId>tf-s3-archetype</artifactId>
Expand Down
Expand Up @@ -4,7 +4,7 @@
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.8-SNAPSHOT</tf-maven-version>
<tf-maven-version>0.8.1</tf-maven-version>
</properties>
<artifactId>${artifactId}</artifactId>
<groupId>${groupId}</groupId>
Expand Down Expand Up @@ -110,6 +110,13 @@
<goal>deploy</goal>
</goals>
</execution>
<execution>
<id>terraform-get</id>
<phase>test-compile</phase>
<goals>
<goal>get</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
Expand Down
@@ -1,24 +1,30 @@
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"
type = string
default = "us-east-1"
}

variable "bucket_name" {
description = "name of the bucket; defaults to a 'bucket-{random id}'"
type = "string"
default = ""
type = string
default = ""
}

variable "environment" {
description = "value of the 'Environment' tag"
type = "string"
default = "dev"
type = string
default = "dev"
}

variable "is_versioned" {
description = "true if versioning is to be enabled, otherwise false; defaults to false"
type = "string"
default = false
type = string
default = false
}

variable "kms_key_arn" {
description = "if set, kms bucket encryption is used with the key arn supplied"
type = string
default = ""
}

0 comments on commit b7b4eb5

Please sign in to comment.