-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #68 from srevinsaju/feature/module-lifecycle-forwa…
…rding feat: forward parent lifecycles to child stages defined on the module
- Loading branch information
Showing
6 changed files
with
120 additions
and
10 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,30 @@ | ||
togomak { | ||
version = 2 | ||
} | ||
|
||
variable "a" { | ||
type = number | ||
description = "first variable" | ||
} | ||
variable "b" { | ||
type = number | ||
description = "second variable" | ||
} | ||
|
||
variable "operation" { | ||
type = string | ||
description = "Operation to perform, any of: [add, subtract, multiply, divide]" | ||
} | ||
|
||
stage "add" { | ||
if = var.operation == "add" | ||
script = "echo ${var.a} + ${var.b} is ${var.a + var.b}" | ||
} | ||
|
||
stage "paths" { | ||
script = <<-EOT | ||
echo path.module: ${path.module} | ||
echo path.cwd: ${path.cwd} | ||
echo path.root: ${path.root} | ||
EOT | ||
} |
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,28 @@ | ||
togomak { | ||
version = 2 | ||
} | ||
|
||
locals { | ||
a = 99 | ||
b = 1 | ||
} | ||
|
||
stage "paths" { | ||
script = <<-EOT | ||
echo path.module: ${path.module} | ||
echo path.cwd: ${path.cwd} | ||
echo path.root: ${path.root} | ||
EOT | ||
} | ||
|
||
module "add" { | ||
source = "./calculator" | ||
a = local.a | ||
b = local.b | ||
operation = "add" | ||
|
||
lifecycle { | ||
phase = ["add"] | ||
} | ||
} | ||
|
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