Skip to content

Commit

Permalink
SCALRCORE-22110 - add pre-init hook to workspace resource and datasource
Browse files Browse the repository at this point in the history
[API_BRANCH]
  • Loading branch information
RomanMytsko committed Jun 10, 2022
1 parent 1e2dd5b commit ec80f21
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions go.sum
Expand Up @@ -302,6 +302,8 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/scalr/go-scalr v0.0.0-20220523083310-b14d71171237 h1:M9d2EOzFFBe/9fqkYpEKK0qKvh1RcZbA6dVWz4k3Rt8=
github.com/scalr/go-scalr v0.0.0-20220523083310-b14d71171237/go.mod h1:xMnwfer9UxugeNITZjTpQBwQ/4bw6/JdyDLpGdmyorE=
github.com/scalr/go-scalr v0.0.0-20220610141547-9940d730b89c h1:KZntuJEnSU4FL03yphXiYlxXi2NodIC8lqJoMzyNGpE=
github.com/scalr/go-scalr v0.0.0-20220610141547-9940d730b89c/go.mod h1:xMnwfer9UxugeNITZjTpQBwQ/4bw6/JdyDLpGdmyorE=
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ=
Expand Down
14 changes: 14 additions & 0 deletions scalr/resource_scalr_workspace_test.go
Expand Up @@ -41,6 +41,8 @@ func TestAccScalrWorkspace_basic(t *testing.T) {
"scalr_workspace.test", "var_files.0", "test1.tfvars"),
resource.TestCheckResourceAttr(
"scalr_workspace.test", "var_files.1", "test2.tfvars"),
resource.TestCheckResourceAttr(
"scalr_workspace.test", "hooks.0.pre_init", "./scripts/pre-init.sh"),
resource.TestCheckResourceAttr(
"scalr_workspace.test", "hooks.0.pre_plan", "./scripts/pre-plan.sh"),
resource.TestCheckResourceAttr(
Expand Down Expand Up @@ -128,6 +130,8 @@ func TestAccScalrWorkspace_renamed(t *testing.T) {
"scalr_workspace.test", "operations", "true"),
resource.TestCheckResourceAttr(
"scalr_workspace.test", "working_directory", ""),
resource.TestCheckResourceAttr(
"scalr_workspace.test", "hooks.0.pre_init", "./scripts/pre-init.sh"),
resource.TestCheckResourceAttr(
"scalr_workspace.test", "hooks.0.pre_plan", "./scripts/pre-plan.sh"),
resource.TestCheckResourceAttr(
Expand Down Expand Up @@ -155,6 +159,8 @@ func TestAccScalrWorkspace_renamed(t *testing.T) {
"scalr_workspace.test", "operations", "true"),
resource.TestCheckResourceAttr(
"scalr_workspace.test", "working_directory", ""),
resource.TestCheckResourceAttr(
"scalr_workspace.test", "hooks.0.pre_init", "./scripts/pre-init.sh"),
resource.TestCheckResourceAttr(
"scalr_workspace.test", "hooks.0.pre_plan", "./scripts/pre-plan.sh"),
resource.TestCheckResourceAttr(
Expand Down Expand Up @@ -190,6 +196,8 @@ func TestAccScalrWorkspace_update(t *testing.T) {
"scalr_workspace.test", "run_operation_timeout", "18"),
resource.TestCheckResourceAttr("scalr_workspace.test", "var_files.0", "test1.tfvars"),
resource.TestCheckResourceAttr("scalr_workspace.test", "var_files.1", "test2.tfvars"),
resource.TestCheckResourceAttr(
"scalr_workspace.test", "hooks.0.pre_init", "./scripts/pre-init.sh"),
resource.TestCheckResourceAttr(
"scalr_workspace.test", "hooks.0.pre_plan", "./scripts/pre-plan.sh"),
resource.TestCheckResourceAttr(
Expand Down Expand Up @@ -223,6 +231,8 @@ func TestAccScalrWorkspace_update(t *testing.T) {
"scalr_workspace.test", "var_files.0", "test1updated.tfvars"),
resource.TestCheckResourceAttr(
"scalr_workspace.test", "var_files.1", "test2updated.tfvars"),
resource.TestCheckResourceAttr(
"scalr_workspace.test", "hooks.0.pre_init", "./scripts/pre-init_updated.sh"),
resource.TestCheckResourceAttr(
"scalr_workspace.test", "hooks.0.pre_plan", "./scripts/pre-plan_updated.sh"),
resource.TestCheckResourceAttr(
Expand Down Expand Up @@ -462,6 +472,7 @@ resource scalr_workspace test {
run_operation_timeout = 18
var_files = ["test1.tfvars", "test2.tfvars"]
hooks {
pre_init = "./scripts/pre-init.sh"
pre_plan = "./scripts/pre-plan.sh"
post_plan = "./scripts/post-plan.sh"
pre_apply = "./scripts/pre-apply.sh"
Expand All @@ -487,6 +498,7 @@ resource "scalr_workspace" "test" {
auto_apply = true
run_operation_timeout = 18
hooks {
pre_init = "./scripts/pre-init.sh"
pre_plan = "./scripts/pre-plan.sh"
post_plan = "./scripts/post-plan.sh"
pre_apply = "./scripts/pre-apply.sh"
Expand All @@ -507,6 +519,7 @@ resource "scalr_workspace" "test" {
run_operation_timeout = 200
var_files = ["test1updated.tfvars", "test2updated.tfvars"]
hooks {
pre_init = "./scripts/pre-init_updated.sh"
pre_plan = "./scripts/pre-plan_updated.sh"
post_plan = "./scripts/post-plan_updated.sh"
pre_apply = "./scripts/pre-apply_updated.sh"
Expand Down Expand Up @@ -566,6 +579,7 @@ resource "scalr_workspace" "test" {
terraform_version = "0.12.19"
working_directory = ""
hooks {
pre_init = "./scripts/pre-init_updated.sh"
pre_plan = "./scripts/pre-plan_updated.sh"
post_plan = "./scripts/post-plan_updated.sh"
pre_apply = "./scripts/pre-apply_updated.sh"
Expand Down

0 comments on commit ec80f21

Please sign in to comment.