diff --git a/pom.xml b/pom.xml index e45e0ab..432476c 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ UTF-8 - 0.11.1 + 0.11.2 azbuilder https://sonarcloud.io true diff --git a/terraform-client/pom.xml b/terraform-client/pom.xml index 0fefa26..5a7a2ad 100644 --- a/terraform-client/pom.xml +++ b/terraform-client/pom.xml @@ -23,7 +23,7 @@ 3.3.0 3.6.2 3.1.0 - 0.11.1 + 0.11.2 false 2.15.0 3.9.5 diff --git a/terraform-client/src/main/java/org/terrakube/terraform/TerraformClient.java b/terraform-client/src/main/java/org/terrakube/terraform/TerraformClient.java index ffe1045..27825db 100644 --- a/terraform-client/src/main/java/org/terrakube/terraform/TerraformClient.java +++ b/terraform-client/src/main/java/org/terrakube/terraform/TerraformClient.java @@ -30,6 +30,8 @@ public class TerraformClient implements AutoCloseable { private static final String TERRAFORM_PARAM_PLAN_DESTROY = "-destroy"; private static final String TERRAFORM_PARAM_OUTPUT_PLAN_FILE = "terraformLibrary.tfPlan"; private static final String TERRAFORM_PARAM_DISABLE_USER_INPUT = "-input=false"; + private static final String TERRAFORM_PLAN_REFRESH_FALSE="-refresh=false"; + private static final String TERRAFORM_PLAN_REFRESH_ONLY="-refresh-only"; private final ExecutorService executor = Executors.newWorkStealingPool(); @@ -294,6 +296,14 @@ private ProcessLauncher getTerraformLauncher(TerraformProcessData terraformProce break; case planDestroy: case plan: + if (!terraformProcessData.isRefresh()){ + launcher.appendCommands(TERRAFORM_PLAN_REFRESH_FALSE); + } + + if (terraformProcessData.isRefreshOnly()){ + launcher.appendCommands(TERRAFORM_PLAN_REFRESH_ONLY); + } + if (terraformProcessData.getVarFileName() == null) for (Map.Entry entry : terraformProcessData.getTerraformVariables().entrySet()) { launcher.appendCommands(TERRAFORM_PARAM_VARIABLE, entry.getKey().concat("=").concat(entry.getValue())); diff --git a/terraform-client/src/main/java/org/terrakube/terraform/TerraformProcessData.java b/terraform-client/src/main/java/org/terrakube/terraform/TerraformProcessData.java index 797bcb2..9b17ea0 100644 --- a/terraform-client/src/main/java/org/terrakube/terraform/TerraformProcessData.java +++ b/terraform-client/src/main/java/org/terrakube/terraform/TerraformProcessData.java @@ -15,6 +15,10 @@ public class TerraformProcessData { String terraformBackendConfigFileName; String varFileName; File sshFile; + @Builder.Default + boolean refresh = true; + @Builder.Default + boolean refreshOnly = false; @Singular Map terraformVariables; @Singular Map terraformEnvironmentVariables; } diff --git a/terraform-spring-boot-autoconfigure/pom.xml b/terraform-spring-boot-autoconfigure/pom.xml index 1fdfd81..3206df7 100644 --- a/terraform-spring-boot-autoconfigure/pom.xml +++ b/terraform-spring-boot-autoconfigure/pom.xml @@ -22,7 +22,7 @@ 3.3.0 3.6.2 3.1.0 - 0.11.1 + 0.11.2 false 1.18.30 11 diff --git a/terraform-spring-boot-samples/pom.xml b/terraform-spring-boot-samples/pom.xml index fd09632..0eec0eb 100644 --- a/terraform-spring-boot-samples/pom.xml +++ b/terraform-spring-boot-samples/pom.xml @@ -18,7 +18,7 @@ UTF-8 - 0.11.1 + 0.11.2 true 11 11 diff --git a/terraform-spring-boot-samples/raw-client-library-sample/pom.xml b/terraform-spring-boot-samples/raw-client-library-sample/pom.xml index 6f14ac1..5197025 100644 --- a/terraform-spring-boot-samples/raw-client-library-sample/pom.xml +++ b/terraform-spring-boot-samples/raw-client-library-sample/pom.xml @@ -20,7 +20,7 @@ UTF-8 true - 0.11.1 + 0.11.2 11 11 diff --git a/terraform-spring-boot-samples/spring-starter-sample/pom.xml b/terraform-spring-boot-samples/spring-starter-sample/pom.xml index 5cb984d..0567622 100644 --- a/terraform-spring-boot-samples/spring-starter-sample/pom.xml +++ b/terraform-spring-boot-samples/spring-starter-sample/pom.xml @@ -20,7 +20,7 @@ UTF-8 true - 0.11.1 + 0.11.2 11 11 diff --git a/terraform-spring-boot-starter/pom.xml b/terraform-spring-boot-starter/pom.xml index 0c8b0ac..12300b9 100644 --- a/terraform-spring-boot-starter/pom.xml +++ b/terraform-spring-boot-starter/pom.xml @@ -17,7 +17,7 @@ 3.3.0 3.6.2 3.1.0 - 0.11.1 + 0.11.2 false 11 11