Skip to content
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 an error_tag optional field to resource.shell_script #62

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mrzor
Copy link

@mrzor mrzor commented Jul 26, 2020

This is a hack that fixes #60.

I believe the footprint to be reasonably small and that it has some merit.

I'm tempted to use a DiffSuppressFunc that disables the diff entirely for this field, hoping to trigger no changes at all when adding an error_tag or changing it - but that may be counter-intuitive ; and it would take some explaining - so I refrained.

The biggest downside is that it's not very Terraformish. Maybe the real solution for #60 should be within Terraform itself.

The tests pass and I added an extra one, but I'm in no way sure that I did not break anything.

Feel free to close if you believe this fix is too much of a burden to maintain or ill designed.

@scottwinkler
Copy link
Owner

I think this could be a good idea except i would like to see it combined with the retry block from earlier. For example, I could see something like:

	resource "shell_script" "basic" {
		lifecycle_commands {
		  create = <<EOF
		    echo "Something went wrong!"
			exit 1
EOF
		  delete = "exit 1"
		}
		environment = {
		  filename= "create_delete.json"
		}
                on_error = {
                  tag = var.username
                  retry = {
                       exit_code = 30
                       delay = 5
                  }
                }
	  }
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add resource address to error message
2 participants