Skip to content

Commit

Permalink
feat(DMVP-2706): add option to autmatically run apply if plan was suc…
Browse files Browse the repository at this point in the history
…cessful
  • Loading branch information
aramkarapetian committed Sep 6, 2023
1 parent 0d55bba commit 89133d1
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 56 deletions.
1 change: 1 addition & 0 deletions modules/workspace/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ resource "tfe_workspace" "this" {
global_remote_state = var.workspace.global_remote_state
project_id = local.project_id
working_directory = "${var.workspace.directory}${var.name}"
auto_apply = var.auto_apply

dynamic "vcs_repo" {
for_each = try(var.repo.identifier, null) == null ? [] : [var.repo]
Expand Down
6 changes: 6 additions & 0 deletions modules/workspace/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,9 @@ variable "output" {
default = []
description = "The module output"
}

variable "auto_apply" {
type = bool
default = false
description = "To have workspaces automatically apply after plan is done successfully."
}
2 changes: 2 additions & 0 deletions tests/basic/1-example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@ module "basic" {
secret_access_key = ""
default_region = ""
}

auto_apply = true
}
56 changes: 0 additions & 56 deletions tests/basic/example-infra/component-1.yaml

This file was deleted.

2 changes: 2 additions & 0 deletions tests/basic/example-infra/empty.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
source: dasmeta/null/empty
version: 1.0.1
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,9 @@ variable "aws" {
# description = "The aws default region"
# }
}

variable "auto_apply" {
type = bool
default = false
description = "To have workspaces automatically apply after plan is done successfully."
}
2 changes: 2 additions & 0 deletions workspaces.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ module "workspaces" {
module_providers = try(each.value.providers, [])
linked_workspaces = try(each.value.linked_workspaces, null)

auto_apply = var.auto_apply

workspace = {
org = var.org
directory = var.rootdir
Expand Down

0 comments on commit 89133d1

Please sign in to comment.