-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add create and destroy scripts for the module to run #9
Add create and destroy scripts for the module to run #9
Conversation
We might need to add variables for |
Yes, let's add |
I added You can see the implementation of it used in the project factory PR here I couldn't add a However, I was able to replicate the dependency tree by passing extra keys to the |
examples/simple_example/main.tf
Outdated
@@ -26,4 +26,7 @@ module "cli" { | |||
|
|||
create_cmd_body = "services enable youtube.googleapis.com --project ${var.project_id}" | |||
destroy_cmd_body = "services disable youtube.googleapis.com --project ${var.project_id}" | |||
|
|||
create_script = "${path.module}/scripts/script.sh" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should make a script a separate example from a simple command (though I'm actually curious as to whether scripts could simply be passed as a command?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added a script_example
and test. Similar to the simple_example
but using a script to enable and disable an api.
I could probably remove the new script
vars in favor of utilizing the existing create|destroy_cmd_entrypoint
variables.
Right now they default to gcloud
- but passing in the script instead should work (assuming I also prepend the bin directory to the path). Arguments to the script could use the existing create|destroy_cmd_body
vars.
Something like this uses all existing vars and will achieve the same effect without breaking original functionality.
module "cli" {
source = "../.."
platform = "linux"
additional_components = ["kubectl", "beta"]
create_cmd_entrypoint = "${path.module}/scripts/script.sh"
create_cmd_body = "enable ${var.project_id}"
destroy_cmd_entrypoint = "${path.module}/scripts/script.sh"
destroy_cmd_body = "disable ${var.project_id}"
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went ahead and committed that. It does make the change quite a bit simpler. I'll update the project-factory
PR for this approach too
@taylorludwig Looks great thanks, released as v0.3.0 so please update pfactory to that. |
Add create and destroy scripts for the module to run Former-commit-id: ab5b5f3
Will use for implementation in terraform-google-modules/terraform-google-project-factory#343