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

Fix bug where nothing ever rotates #21

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

Conversation

JonasKop
Copy link

@JonasKop JonasKop commented Dec 22, 2024

Fixes this bug: #11

The bug was caused since the stored terraform state timestamp was used to check whenever a rotation should happen. Since that value was always in the past, behind the expiration date a rotation was never performed. When using the current timestamp it now always works for me. I have tested it using the following terraform code with a .terraformrc dev override.

terraform {
  required_providers {
    multirotate = {
      source = "hashicorp.com/edu/multirotate"
    }
  }
}

resource "multirotate_set" "token_rotation" {
  rotation_period = "10s"
  number          = 2
}

resource "local_file" "example" {
  count    = multirotate_set.token_rotation.number
  filename = "file1-${count.index}"
  content  = multirotate_set.token_rotation.rotation_set[count.index].expiration
}
provider_installation {
  dev_overrides {
    "hashicorp.com/edu/multirotate" = "<MY_HOME_DIR>/go/bin"
  }
  direct {}
}

Closes #11

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.

Rotation is not working
1 participant