I am trying to create a IAM Workload Identity Pool and a Pool Provider along with it.
However, running terraform apply sequentially more than once throws an error stating that the requested entity already exists.
This is in fact true but why exactly is this an issue and how can I avoid such an error?
│ Error: Error creating WorkloadIdentityPool: googleapi: Error 409: Requested entity already exists
│
│ with google_iam_workload_identity_pool.github,
│ on main.tf line 36, in resource "google_iam_workload_identity_pool" "github":
│ 36: resource "google_iam_workload_identity_pool" "github" {
This is the Terraform description:
resource "google_iam_workload_identity_pool" "github" {
workload_identity_pool_id = "github-identity-pool"
display_name = "GitHub Workload Identity Pool"
}
resource "google_iam_workload_identity_pool_provider" "github_identity_pool_provider" {
workload_identity_pool_id = google_iam_workload_identity_pool.github.workload_identity_pool_id
workload_identity_pool_provider_id = "github-oidc"
display_name = "GitHub OIDC Provider"
attribute_mapping = {
"google.subject" = "assertion.sub"
}
oidc {
issuer_uri = "https://token.actions.githubusercontent.com"
}
}