Skip to content

Instantly share code, notes, and snippets.

@crandall-chow-bl
Last active February 21, 2022 17:20
Show Gist options
  • Save crandall-chow-bl/b5a427c276f6c2c6be0d402304affe53 to your computer and use it in GitHub Desktop.
Save crandall-chow-bl/b5a427c276f6c2c6be0d402304affe53 to your computer and use it in GitHub Desktop.
terraform-google-modules/gcloud/google invoking the entrypoints/bodies
GOOGLE_APPLICATION_CREDENTIALS="/Users/cxc3981/.ssh/np-bl-match-engine-deployment.json" terraform apply -destroy -auto-approve
module.endpoint_cchow_test.null_resource.run_destroy_command[0]: Refreshing state... [id=322936888810710422]
module.endpoint_cchow_test.null_resource.run_command[0]: Refreshing state... [id=8214569656594219947]
Terraform used the selected providers to generate the following execution plan.
Resource actions are indicated with the following symbols:
- destroy
Terraform will perform the following actions:
# module.endpoint_cchow_test.null_resource.run_command[0] will be destroyed
- resource "null_resource" "run_command" {
- id = "8214569656594219947" -> null
- triggers = {
- "arguments" = "2af72f100c356273d46284f6fd1dfc08"
- "create_cmd_body" = "version"
- "create_cmd_entrypoint" = "gcloud"
- "gcloud_bin_abs_path" = "/google-cloud-sdk/bin"
- "md5" = "7f22bf39aaf5ce5980111c3587bef5b5"
} -> null
}
# module.endpoint_cchow_test.null_resource.run_destroy_command[0] will be destroyed
- resource "null_resource" "run_destroy_command" {
- id = "322936888810710422" -> null
- triggers = {
- "destroy_cmd_body" = "version"
- "destroy_cmd_entrypoint" = "gcloud"
- "gcloud_bin_abs_path" = "/google-cloud-sdk/bin"
} -> null
}
Plan: 0 to add, 0 to change, 2 to destroy.
module.endpoint_cchow_test.null_resource.run_destroy_command[0]: Destroying... [id=322936888810710422]
module.endpoint_cchow_test.null_resource.run_command[0]: Destroying... [id=8214569656594219947]
module.endpoint_cchow_test.null_resource.run_destroy_command[0]: Provisioning with 'local-exec'...
module.endpoint_cchow_test.null_resource.run_command[0]: Destruction complete after 0s
module.endpoint_cchow_test.null_resource.run_destroy_command[0] (local-exec): Executing: ["/bin/sh" "-c" "PATH=/google-cloud-sdk/bin:$PATH\ngcloud version\n"]
module.endpoint_cchow_test.null_resource.run_destroy_command[0] (local-exec): Google Cloud SDK 372.0.0
module.endpoint_cchow_test.null_resource.run_destroy_command[0] (local-exec): beta 2022.02.04
module.endpoint_cchow_test.null_resource.run_destroy_command[0] (local-exec): bq 2.0.73
module.endpoint_cchow_test.null_resource.run_destroy_command[0] (local-exec): core 2022.02.04
module.endpoint_cchow_test.null_resource.run_destroy_command[0] (local-exec): gsutil 5.6
module.endpoint_cchow_test.null_resource.run_destroy_command[0]: Destruction complete after 1s
Apply complete! Resources: 0 added, 0 changed, 2 destroyed.
GOOGLE_APPLICATION_CREDENTIALS="/Users/cxc3981/.ssh/np-bl-match-engine-deployment.json" terraform apply -auto-approve
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# module.endpoint_cchow_test.null_resource.run_command[0] will be created
+ resource "null_resource" "run_command" {
+ id = (known after apply)
+ triggers = {
+ "arguments" = "2af72f100c356273d46284f6fd1dfc08"
+ "create_cmd_body" = "version"
+ "create_cmd_entrypoint" = "gcloud"
+ "gcloud_bin_abs_path" = "/google-cloud-sdk/bin"
+ "md5" = "7f22bf39aaf5ce5980111c3587bef5b5"
}
}
# module.endpoint_cchow_test.null_resource.run_destroy_command[0] will be created
+ resource "null_resource" "run_destroy_command" {
+ id = (known after apply)
+ triggers = {
+ "destroy_cmd_body" = "version"
+ "destroy_cmd_entrypoint" = "gcloud"
+ "gcloud_bin_abs_path" = "/google-cloud-sdk/bin"
}
}
Plan: 2 to add, 0 to change, 0 to destroy.
module.endpoint_cchow_test.null_resource.run_command[0]: Creating...
module.endpoint_cchow_test.null_resource.run_destroy_command[0]: Creating...
module.endpoint_cchow_test.null_resource.run_destroy_command[0]: Creation complete after 0s [id=3385710549782375618]
module.endpoint_cchow_test.null_resource.run_command[0]: Provisioning with 'local-exec'...
module.endpoint_cchow_test.null_resource.run_command[0] (local-exec): Executing: ["/bin/sh" "-c" "PATH=/google-cloud-sdk/bin:$PATH\ngcloud version\n"]
module.endpoint_cchow_test.null_resource.run_command[0] (local-exec): Google Cloud SDK 372.0.0
module.endpoint_cchow_test.null_resource.run_command[0] (local-exec): beta 2022.02.04
module.endpoint_cchow_test.null_resource.run_command[0] (local-exec): bq 2.0.73
module.endpoint_cchow_test.null_resource.run_command[0] (local-exec): core 2022.02.04
module.endpoint_cchow_test.null_resource.run_command[0] (local-exec): gsutil 5.6
module.endpoint_cchow_test.null_resource.run_command[0]: Creation complete after 2s [id=9175274156995563609]
Apply complete! Resources: 2 added, 0 changed, 0 destroyed.
GOOGLE_APPLICATION_CREDENTIALS="/Users/cxc3981/.ssh/np-bl-match-engine-deployment.json" terraform apply -auto-approve
module.endpoint_cchow_test.null_resource.run_destroy_command[0]: Refreshing state... [id=3385710549782375618]
module.endpoint_cchow_test.null_resource.run_command[0]: Refreshing state... [id=9175274156995563609]
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
- destroy
Terraform will perform the following actions:
# module.endpoint_cchow_test.null_resource.run_command[0] will be destroyed
# (because null_resource.run_command is not in configuration)
- resource "null_resource" "run_command" {
- id = "9175274156995563609" -> null
- triggers = {
- "arguments" = "2af72f100c356273d46284f6fd1dfc08"
- "create_cmd_body" = "version"
- "create_cmd_entrypoint" = "gcloud"
- "gcloud_bin_abs_path" = "/google-cloud-sdk/bin"
- "md5" = "7f22bf39aaf5ce5980111c3587bef5b5"
} -> null
}
# module.endpoint_cchow_test.null_resource.run_destroy_command[0] will be destroyed
# (because null_resource.run_destroy_command is not in configuration)
- resource "null_resource" "run_destroy_command" {
- id = "3385710549782375618" -> null
- triggers = {
- "destroy_cmd_body" = "version"
- "destroy_cmd_entrypoint" = "gcloud"
- "gcloud_bin_abs_path" = "/google-cloud-sdk/bin"
} -> null
}
Plan: 0 to add, 0 to change, 2 to destroy.
module.endpoint_cchow_test.null_resource.run_destroy_command[0]: Destroying... [id=3385710549782375618]
module.endpoint_cchow_test.null_resource.run_command[0]: Destroying... [id=9175274156995563609]
module.endpoint_cchow_test.null_resource.run_command[0]: Destruction complete after 0s
module.endpoint_cchow_test.null_resource.run_destroy_command[0]: Destruction complete after 0s
Apply complete! Resources: 0 added, 0 changed, 2 destroyed.
@crandall-chow-bl
Copy link
Author

When "create"-ing, it invokes the configured create_cmd_entrypoint and create_cmd_body, showing the contents of the gcloud version command.

When "destroy"-ing, it does not call the configured entrypoint and body, even though it goes through the motions of destroying it from the tfstate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment