Last active
November 13, 2020 21:33
-
-
Save rafagsiqueira/14700c99aeacbcf1202004e1d49e2b46 to your computer and use it in GitHub Desktop.
This file contains 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
data "http" "access_token" { | |
url = "https://${var.docker_registry.host}/oauth2/token?service=${var.docker_registry.host}&scope=repository:*:pull" | |
request_headers = { | |
Authorization = "Basic ${base64encode("${var.docker_registry.user}:${var.docker_registry.password}")}" | |
} | |
} | |
data "http" "tips-admin" { | |
url = "https://${var.docker_registry.host}/v2/tips-admin/manifests/${local.environment}" | |
request_headers = { | |
Accept = "application/vnd.docker.distribution.manifest.v2+json", | |
Authorization = "Bearer ${jsondecode(data.http.access_token.body).access_token}" | |
} | |
} | |
output "tips-admin" { | |
value = "${var.docker_registry.host}/tips-admin@${data.http.tips-admin.response_headers.Docker-Content-Digest}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment