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

Feature request: Add support for login with externally issued tokens (JWT) #473

Open
googol opened this issue Aug 9, 2024 · 1 comment

Comments

@googol
Copy link

googol commented Aug 9, 2024

Since Nomad now has support for logging in with JWTs issued by external identity providers, and those can be configured by this terraform provider, the next step would be to enable login with these tokens.

The endpoint to use is documented here: #448

The configuration syntax could be either individual properties like, where they both have to be null or not-null:

provider "nomad" {
  auth_method_name = "github"
  login_token      = var.login_token
}

or a like the auth_login_jwt block in the vault provider, where both would be required if the block is defined:

provider "nomad" {
  auth_login_jwt {
    auth_method_name = "github"
    login_token      = var.login_token
  }
}
@googol
Copy link
Author

googol commented Aug 9, 2024

If there's no major difference implementation-wise, I'd prefer having the properties straight on the provider, for easier dynamic configuration. If the terraform code needs to be callable by persons, as well as something like gitlab ci, the JWT needs to be dynamically configurable, which for the vault provider requires a dynamic block, which is clunky old syntax:

provider "vault" {
  dynamic "auth_login_jwt" {
    for_each = var.jwt != null ? { "jwt" = var.jwt } : {}
    iterator = each

    content {
      role  = "role-name"
      mount = "gitlab"
      jwt   = each.value
    }
  }
}

but if it was directly on the provider this would collapse to something like:

provider "vault" {
  jwt_auth_role  = var.jwt != null ? "role-name" : null
  jwt_auth_mount = var.jwt != null ? "gitlab" : null
  jwt_token      = var.jwt
}

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