-
Notifications
You must be signed in to change notification settings - Fork 708
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
Add azurerm_federated_identity_credential resource #1666
base: main
Are you sure you want to change the base?
Add azurerm_federated_identity_credential resource #1666
Conversation
Thanks for the PR @mdanylyuk, can you please add an example which can be fully tested in standalone tests (add an AKS cluster, or a scenario that can be self-sufficient). When testing your code, getting the following:
|
Thanks for the comment, |
hi @mdanylyuk, thanks for the update, im now getting the following error:
|
Hello @arnaudlh, |
@mdanylyuk, the plan works fine, its an apply time error. It is easy to repro, I'm just running the example here :)
|
@arnaudlh, many thanks! It's really my mistake (sorry but I worked in the multiple repos with it and missed adding) |
audience = each.value.audience | ||
issuer = each.value.issuer != null ? each.value.issuer : local.combined_objects_aks_clusters[try(each.value.aks_cluster.lz_key, local.client_config.landingzone_key)][each.value.aks_cluster.key].oidc_issuer_url | ||
parent_id = module.managed_identities[each.value.managed_identity_key].id | ||
subject = each.value.subject != null ? each.value.subject : try("system:serviceaccount:${each.value.kubernetes.namespace}:${each.value.kubernetes.service_account}", null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still getting errors for the examples for the managed_identities = {
poc = { }
with the following
│ Federated Identity Credential Name: "xxgi-msi-dev"): managedidentities.ManagedIdentitiesClient#FederatedIdentityCredentialsCreateOrUpdate: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error.
│ Status=400 Code="BadRequest" Message="The request format was unexpected. Federated Identity Credential must specify 'issuer', 'subject' and 'audience'."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Subject cant be null as per: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/federated_identity_credential#subject
@arnaudlh
I know that it's a required parameter. But I set "null" for failing run in a case when a user does not provide "subject" or "kubernetes" parameters. If you are not ok with this logic I will remove "null"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets fail if we dont have a value, its better to fail at plan-time than at apply-time (the error message above).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets fail if we dont have a value, its better to fail at plan-time than at apply-time (the error message above).
But yes, with this condition plan will fail if you missed one of the parameters "subject" or "kubernetes"
##[error]╷
│ Error: Missing required argument
│
│ with module.solution.azurerm_federated_identity_credential.fidc_aks["dev_poc_dev"],
│ on .terraform/modules/solution/managed_identities.tf line 38, in resource "azurerm_federated_identity_credential" "fidc_aks":
│ 38: subject = each.value.subject != null ? each.value.subject : try("system:serviceaccount:${each.value.kubernetes.namespace}:${each.value.kubernetes.service_account}", null)
│
│ The argument "subject" is required, but no definition was found.
╵
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still getting errors for the examples for the managed_identities = { poc = { }
with the following │ Federated Identity Credential Name: "xxgi-msi-dev"): managedidentities.ManagedIdentitiesClient#FederatedIdentityCredentialsCreateOrUpdate: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. │ Status=400 Code="BadRequest" Message="The request format was unexpected. Federated Identity Credential must specify 'issuer', 'subject' and 'audience'."
I've just tested on my environment and it works fine.
Please attach plan - want to see how it tries to create.
1664
PR Checklist
Description
Does this introduce a breaking change
Changes in the code support working with azurerm_federated_identity_credential resource.
This is required for replacing deprecated AAD Pod Identity with Azure AD workload identity with Azure Kubernetes Service
Testing