Last active
November 20, 2020 19:52
-
-
Save raphink/43bb67aebfca2a604f1cc4603ca055ea to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "jwt_hashed_token" "argocd" { | |
algorithm = "HS256" | |
claims_json = jsonencode( | |
{ | |
iat = 1605854613 | |
iss = "argocd" | |
jti = "d58253cb-82b9-c58f-5ffd-fea1e8b5afc2" | |
nbf = 1605854613 | |
sub = "pipeline" | |
} | |
) | |
id = jsonencode( | |
{ | |
iat = 1605854613 | |
iss = "argocd" | |
jti = "d58253cb-82b9-c58f-5ffd-fea1e8b5afc2" | |
nbf = 1605854613 | |
sub = "pipeline" | |
} | |
) | |
secret = (sensitive value) | |
token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE2MDU4NTQ2MTMsImlzcyI6ImFyZ29jZCIsImp0aSI6ImQ1ODI1M2NiLTgyYjktYzU4Zi01ZmZkLWZlYTFlOGI1YWZjMiIsIm5iZiI6MTYwNTg1NDYxMywic3ViIjoicGlwZWxpbmUifQ.Xoifr2t3xek7Cw5crq8HvyFb7fzT_89gPiSxjy36N14" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "random_uuid" "accounts_pipeline_token_id" {} | |
locals { | |
iat = 1605854613 # An arbitrary Unix timestamp before than now | |
jwt_token_header = { | |
alg = "HS256" | |
typ = "JWT" | |
} | |
jwt_token_payload = { | |
jti = random_uuid.accounts_pipeline_token_id.result | |
iat = local.iat | |
iss = "argocd" | |
nbf = local.iat | |
sub = "pipeline" | |
} | |
} | |
output "jwt_token_payload" { | |
value = local.jwt_token_payload | |
} | |
resource "jwt_hashed_token" "argocd" { | |
algorithm = "HS256" | |
secret = "abcdef" | |
claims_json = jsonencode(local.jwt_token_payload) | |
} | |
output "jwt_hashed_token_claims" { | |
value = jwt_hashed_token.argocd.claims_json | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Outputs: | |
jwt_hashed_token_claims = {"iat":1605854613,"iss":"argocd","jti":"d58253cb-82b9-c58f-5ffd-fea1e8b5afc2","nbf":1605854613,"sub":"pipeline"} | |
jwt_token_payload = { | |
"iat" = 1605854613 | |
"iss" = "argocd" | |
"jti" = "d58253cb-82b9-c58f-5ffd-fea1e8b5afc2" | |
"nbf" = 1605854613 | |
"sub" = "pipeline" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment