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

Provider doesn't perform "update" when i'm changing the update script. #124

Open
arielbeckjit opened this issue May 7, 2023 · 0 comments

Comments

@arielbeckjit
Copy link

arielbeckjit commented May 7, 2023

Hi, so i have the following configuration:

resource "shell_script" "configure-data-api" {
  environment = {
    ENV = 1
  }
  sensitive_environment = {
    AUTH = var.creds
  }
  lifecycle_commands {
    create = file("${path.module}/configure_data_api_scripts/create.sh")
    update = file("${path.module}/configure_data_api_scripts/update.sh")
    read   = file("${path.module}/configure_data_api_scripts/get.sh")
    delete = file("${path.module}/configure_data_api_scripts/delete.sh")
  }
  interpreter = ["/bin/bash", "-c"]

  lifecycle {
    ignore_changes = [
      sensitive_environment
    ]
  }

  working_directory = path.module
}

The read is the one that outputs the state.
I've enabled debug, and when i've done change in the update (echo something to file) - it just doesn't run.
When i change afterward an env var, then it runs.

this is the log i'm seeing, it looks like update wasn't even run (no debug log from update)

2023-05-07T20:50:52.571+0300 [WARN]  Provider "registry.terraform.io/scottwinkler/shell" produced an invalid plan for module.......configure-data-api, but we are tolerating it because it is using the legacy plugin SDK.
    The following problems may be the cause of any confusing errors from downstream operations:
      - .dirty: planned value cty.False for a non-computed attribute
      - .read_error: planned value cty.StringVal("") for a non-computed attribute
�[0m�[1mmodule........configure-data-api: Modifying... [id=ch922u7o42dch29efo30]�[0m�[0m
2023-05-07T20:50:52.593+0300 [INFO]  Starting apply for module........shell_script.configure-data-api
2023-05-07T20:50:52.593+0300 [DEBUG] module......].shell_script.configure-data-api: applying the planned Update change
�[0m�[1mmodule.......t.configure-data-api: Modifications complete after 0s [id=ch922u7o42dch29efo30]�[0m

I've managed to see where's the problem, this code when update is performed:

	if d.HasChanges("lifecycle_commands", "interpreter") {
		return
	}

lifecycle_commands changes of course, because script is updated - so the update is not triggered...

related PR that added the bug
#81

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

No branches or pull requests

1 participant