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

Improve metadata attribute by adding last deployed date #1374

Closed
danielskowronski opened this issue May 28, 2024 · 1 comment
Closed

Improve metadata attribute by adding last deployed date #1374

danielskowronski opened this issue May 28, 2024 · 1 comment

Comments

@danielskowronski
Copy link
Contributor

Description

helm_release has an attribute metadata that's missing "last updated" date which is always returned by Helm. That field (combined with app_revision) is quite useful to determine triggers in complex deployment scenarios, as it's the closest thing to a release UUID we have.

Potential Terraform Configuration

This is example code that implements a crude workaround that's not 100% bullet-proof (and probably violates many Terraform usage guides, but it's only an example). Availability of helm_release.foo.metadata.last_deployed would make this example trick with description obsolete.

resource "helm_release" "foo" {
  name        = "foo"
  repository  = "./foo/"
  wait        = true
  description = "foo planned at ${timestamp()}"

  lifecycle {
    ignore_changes = [
      description
    ]
  }
}

resource "helm_release" "bar" {
  name        = "bar"
  repository  = "./bar/"
  wait        = true
  description = "bar planned at ${timestamp()}"

  depends_on = [
    helm_release.foo
  ]

  lifecycle {
    replace_triggered_by = [
      helm_release.foo.metadata.revision,
      helm_release.foo.description,
    ]
    ignore_changes = [
      description
    ]
  }
}

References

example execution helm get all foo showing what's available (descriptions managed by example trick from above):

NAME: foo
LAST DEPLOYED: Tue May 28 17:31:40 2024
NAMESPACE: default
STATUS: deployed
REVISION: 1
CHART: foo
VERSION: v0.0.2
APP_VERSION: 
TEST SUITE: None
USER-SUPPLIED VALUES:
description: foo planned at 2024-05-28T15:29:53Z

COMPUTED VALUES:
description: foo planned at 2024-05-28T15:29:53Z
key1: value1

HOOKS:
MANIFEST:
...

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
danielskowronski added a commit to danielskowronski/terraform-provider-helm that referenced this issue Jun 4, 2024
- last_deployed to implement hashicorp#1374
- first_deployed and notes to extend functionality further
appilon pushed a commit to danielskowronski/terraform-provider-helm that referenced this issue Jun 11, 2024
- last_deployed to implement hashicorp#1374
- first_deployed and notes to extend functionality further
appilon added a commit that referenced this issue Jun 11, 2024
* extend helm_release.metadata with new computed fields

- last_deployed to implement #1374
- first_deployed and notes to extend functionality further

* add tests, fix uses of helm CLI in tests

tests that are using exec.Command to call helm CLI directly were expecting kubeconfig to be at KUBECONFIG, which may not be the same as KUBE_CONFIG_PATH

---------

Co-authored-by: Alex Pilon <[email protected]>
@danielskowronski
Copy link
Contributor Author

Resolved by #1380 :)

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

No branches or pull requests

2 participants