fix(terraform): corregir OIDC audience para Bitbucket Cloud
Bitbucket Cloud genera tokens JWT con audience fijo: ari:cloud:bitbucket::workspace/465016f8-d6fb-4ecb-ba6f-2248e938942b El archivo oidc-bitbucket.tf solo aceptaba sts.amazonaws.com, lo que causaba InvalidIdentityToken en cada terraform apply. Ahora el OIDC provider y el rol IAM aceptan ambos audiences mediante ForAnyValue:StringEquals.
This commit is contained in:
@@ -14,9 +14,6 @@ locals {
|
|||||||
bitbucket_workspace = "ccsoft1"
|
bitbucket_workspace = "ccsoft1"
|
||||||
bitbucket_oidc_url = "https://api.bitbucket.org/2.0/workspaces/${local.bitbucket_workspace}/pipelines-config/identity/oidc"
|
bitbucket_oidc_url = "https://api.bitbucket.org/2.0/workspaces/${local.bitbucket_workspace}/pipelines-config/identity/oidc"
|
||||||
|
|
||||||
# UUID del workspace de Bitbucket Cloud para el audience fijo del OIDC.
|
|
||||||
bitbucket_workspace_uuid = "465016f8-d6fb-4ecb-ba6f-2248e938942b"
|
|
||||||
|
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
# REPO_UUID de proyectosacc
|
# REPO_UUID de proyectosacc
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
@@ -30,6 +27,9 @@ locals {
|
|||||||
# reemplázalo por el UUID exacto del repo ccsoft1/proyectosacc.
|
# reemplázalo por el UUID exacto del repo ccsoft1/proyectosacc.
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
bitbucket_repo_uuid = "{3ceb5bec-0805-4bfb-b891-aaf5626ad7a5}"
|
bitbucket_repo_uuid = "{3ceb5bec-0805-4bfb-b891-aaf5626ad7a5}"
|
||||||
|
|
||||||
|
# Workspace UUID de Bitbucket Cloud (audience fijo de los tokens JWT)
|
||||||
|
bitbucket_workspace_uuid = "465016f8-d6fb-4ecb-ba6f-2248e938942b"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Obtener el thumbprint del certificado TLS del issuer OIDC
|
# Obtener el thumbprint del certificado TLS del issuer OIDC
|
||||||
@@ -43,9 +43,9 @@ data "tls_certificate" "bitbucket_oidc" {
|
|||||||
resource "aws_iam_openid_connect_provider" "bitbucket" {
|
resource "aws_iam_openid_connect_provider" "bitbucket" {
|
||||||
url = local.bitbucket_oidc_url
|
url = local.bitbucket_oidc_url
|
||||||
|
|
||||||
# Bitbucket Cloud usa "ari:cloud:bitbucket::workspace/{uuid}" como audience
|
# Bitbucket Cloud usa `ari:cloud:bitbucket::workspace/{uuid}` como audience
|
||||||
# fijo en los tokens JWT. Mantenemos "sts.amazonaws.com" por compatibilidad
|
# fijo en los tokens JWT. Mantenemos `sts.amazonaws.com` por compatibilidad
|
||||||
# con pipelines que aún lo configuren manualmente.
|
# con configuraciones que lo usen explícitamente.
|
||||||
client_id_list = [
|
client_id_list = [
|
||||||
"sts.amazonaws.com",
|
"sts.amazonaws.com",
|
||||||
"ari:cloud:bitbucket::workspace/${local.bitbucket_workspace_uuid}"
|
"ari:cloud:bitbucket::workspace/${local.bitbucket_workspace_uuid}"
|
||||||
|
|||||||
Reference in New Issue
Block a user