-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Add converter for google_iam_workload_identity_pool_provider #12
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
base: main
Are you sure you want to change the base?
Changes from 2 commits
4bd34c2
07d9e12
c6c7351
ade8350
390f4fa
fe6fd82
649d50d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -0,0 +1,21 @@ | ||||
| [ | ||||
| { | ||||
| "name": "//iam.googleapis.com/projects/{{.Provider.project}}/locations/global/workloadIdentityPools/gg-asset-44602-7df7/providers/gg-asset-44602-7df7", | ||||
| "asset_type": "iam.googleapis.com/WorkloadIdentityPoolProvider", | ||||
| "ancestry_path": "{{.Ancestry}}/project/{{.Provider.project}}", | ||||
| "resource": { | ||||
| "version": "v1", | ||||
| "discovery_document_uri": "https://iam.googleapis.com/$discovery/rest", | ||||
| "discovery_name": "WorkloadIdentityPoolProvider", | ||||
| "parent": "//iam.googleapis.com/projects/{{.Provider.project}}/locations/global/workloadIdentityPools/gg-asset-44602-7df7", | ||||
| "data": { | ||||
| "aws": { | ||||
| "accountId": "111111111111" | ||||
| }, | ||||
| "description": "AWS provider for gg-asset-44602-7df7", | ||||
| "displayName": "gg-asset-44602-7df7" | ||||
| }, | ||||
| "location": "global" | ||||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you for the feedback. I have prettified the file.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Addressed. |
||||
| } | ||||
| } | ||||
| ] | ||||
|
hemantadil marked this conversation as resolved.
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add one more test case. You can use following to guide your implementation. --- EXAMPLE 2 --- Terraform HCL: # Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may
# obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
terraform {
required_providers {
google = {
source = "hashicorp/google"
version = ">= 4.54.0"
}
}
}
provider "google" {
project = var.project_id
}
variable "project_id" {
description = "The project ID to host the resources."
type = string
}
variable "organization_id" {
description = "The organization ID."
type = string
}
resource "google_iam_workload_identity_pool" "gg_asset_45050_bcd4" {
project = var.project_id
workload_identity_pool_id = "gg-asset-45050-bcd4"
display_name = "gg-asset-45050-bcd4"
description = "Workload Identity Pool for gg-asset-45050-bcd4"
disabled = false
}
resource "google_iam_workload_identity_pool_provider" "gg_asset_45050_bcd4" {
project = var.project_id
workload_identity_pool_id = google_iam_workload_identity_pool.gg_asset_45050_bcd4.workload_identity_pool_id
workload_identity_pool_provider_id = "gg-asset-45050-bcd4"
display_name = "gg-asset-45050-bcd4"
description = "OIDC provider for gg-asset-45050-bcd4"
disabled = true
attribute_mapping = {
"google.subject" = "assertion.sub"
"attribute.actor" = "assertion.actor"
"attribute.repository" = "assertion.repository"
}
attribute_condition = "assertion.repository_owner == 'google'"
oidc {
issuer_uri = "https://oidc.gg-asset-45050-bcd4.com"
}
}Terraform Plan JSON: {"format_version":"1.2","terraform_version":"1.13.3","variables":{"organization_id":{"value":"777838403257"},"project_id":{"value":"hemant-oprv-test"}},"planned_values":{"root_module":{"resources":[{"address":"google_iam_workload_identity_pool.gg_asset_45050_bcd4","mode":"managed","type":"google_iam_workload_identity_pool","name":"gg_asset_45050_bcd4","provider_name":"registry.terraform.io/hashicorp/google","schema_version":0,"values":{"description":"Workload Identity Pool for gg-asset-45050-bcd4","disabled":false,"display_name":"gg-asset-45050-bcd4","project":"hemant-oprv-test","timeouts":null,"workload_identity_pool_id":"gg-asset-45050-bcd4"},"sensitive_values":{}},{"address":"google_iam_workload_identity_pool_provider.gg_asset_45050_bcd4","mode":"managed","type":"google_iam_workload_identity_pool_provider","name":"gg_asset_45050_bcd4","provider_name":"registry.terraform.io/hashicorp/google","schema_version":0,"values":{"attribute_condition":"assertion.repository_owner == 'google'","attribute_mapping":{"attribute.actor":"assertion.actor","attribute.repository":"assertion.repository","google.subject":"assertion.sub"},"aws":[],"description":"OIDC provider for gg-asset-45050-bcd4","disabled":true,"display_name":"gg-asset-45050-bcd4","oidc":[{"allowed_audiences":null,"issuer_uri":"https://oidc.gg-asset-45050-bcd4.com","jwks_json":null}],"project":"hemant-oprv-test","saml":[],"timeouts":null,"workload_identity_pool_id":"gg-asset-45050-bcd4","workload_identity_pool_provider_id":"gg-asset-45050-bcd4","x509":[]},"sensitive_values":{"attribute_mapping":{},"aws":[],"oidc":[{}],"saml":[],"x509":[]}}]}},"resource_changes":[{"address":"google_iam_workload_identity_pool.gg_asset_45050_bcd4","mode":"managed","type":"google_iam_workload_identity_pool","name":"gg_asset_45050_bcd4","provider_name":"registry.terraform.io/hashicorp/google","change":{"actions":["create"],"before":null,"after":{"description":"Workload Identity Pool for gg-asset-45050-bcd4","disabled":false,"display_name":"gg-asset-45050-bcd4","project":"hemant-oprv-test","timeouts":null,"workload_identity_pool_id":"gg-asset-45050-bcd4"},"after_unknown":{"id":true,"name":true,"state":true},"before_sensitive":false,"after_sensitive":{}}},{"address":"google_iam_workload_identity_pool_provider.gg_asset_45050_bcd4","mode":"managed","type":"google_iam_workload_identity_pool_provider","name":"gg_asset_45050_bcd4","provider_name":"registry.terraform.io/hashicorp/google","change":{"actions":["create"],"before":null,"after":{"attribute_condition":"assertion.repository_owner == 'google'","attribute_mapping":{"attribute.actor":"assertion.actor","attribute.repository":"assertion.repository","google.subject":"assertion.sub"},"aws":[],"description":"OIDC provider for gg-asset-45050-bcd4","disabled":true,"display_name":"gg-asset-45050-bcd4","oidc":[{"allowed_audiences":null,"issuer_uri":"https://oidc.gg-asset-45050-bcd4.com","jwks_json":null}],"project":"hemant-oprv-test","saml":[],"timeouts":null,"workload_identity_pool_id":"gg-asset-45050-bcd4","workload_identity_pool_provider_id":"gg-asset-45050-bcd4","x509":[]},"after_unknown":{"attribute_mapping":{},"aws":[],"id":true,"name":true,"oidc":[{}],"saml":[],"state":true,"x509":[]},"before_sensitive":false,"after_sensitive":{"attribute_mapping":{},"aws":[],"oidc":[{}],"saml":[],"x509":[]}}}],"configuration":{"provider_config":{"google":{"name":"google","full_name":"registry.terraform.io/hashicorp/google","version_constraint":"\u003e= 4.54.0","expressions":{"project":{"references":["var.project_id"]}}}},"root_module":{"resources":[{"address":"google_iam_workload_identity_pool.gg_asset_45050_bcd4","mode":"managed","type":"google_iam_workload_identity_pool","name":"gg_asset_45050_bcd4","provider_config_key":"google","expressions":{"description":{"constant_value":"Workload Identity Pool for gg-asset-45050-bcd4"},"disabled":{"constant_value":false},"display_name":{"constant_value":"gg-asset-45050-bcd4"},"project":{"references":["var.project_id"]},"workload_identity_pool_id":{"constant_value":"gg-asset-45050-bcd4"}},"schema_version":0},{"address":"google_iam_workload_identity_pool_provider.gg_asset_45050_bcd4","mode":"managed","type":"google_iam_workload_identity_pool_provider","name":"gg_asset_45050_bcd4","provider_config_key":"google","expressions":{"attribute_condition":{"constant_value":"assertion.repository_owner == 'google'"},"attribute_mapping":{"constant_value":{"attribute.actor":"assertion.actor","attribute.repository":"assertion.repository","google.subject":"assertion.sub"}},"description":{"constant_value":"OIDC provider for gg-asset-45050-bcd4"},"disabled":{"constant_value":true},"display_name":{"constant_value":"gg-asset-45050-bcd4"},"oidc":[{"issuer_uri":{"constant_value":"https://oidc.gg-asset-45050-bcd4.com"}}],"project":{"references":["var.project_id"]},"workload_identity_pool_id":{"references":["google_iam_workload_identity_pool.gg_asset_45050_bcd4.workload_identity_pool_id","google_iam_workload_identity_pool.gg_asset_45050_bcd4"]},"workload_identity_pool_provider_id":{"constant_value":"gg-asset-45050-bcd4"}},"schema_version":0}],"variables":{"organization_id":{"description":"The organization ID."},"project_id":{"description":"The project ID to host the resources."}}}},"relevant_attributes":[{"resource":"google_iam_workload_identity_pool.gg_asset_45050_bcd4","attribute":["workload_identity_pool_id"]}],"timestamp":"2025-10-31T21:11:11Z","applyable":true,"complete":true,"errored":false}Resulting CAI JSON: [
{
"ancestors": [
"projects/610696529633",
"organizations/777838403257"
],
"assetType": "iam.googleapis.com/WorkloadIdentityPool",
"name": "//iam.googleapis.com/projects/610696529633/locations/global/workloadIdentityPools/gg-asset-45050-bcd4",
"resource": {
"data": {
"description": "Workload Identity Pool for gg-asset-45050-bcd4",
"displayName": "gg-asset-45050-bcd4",
"name": "projects/610696529633/locations/global/workloadIdentityPools/gg-asset-45050-bcd4",
"state": "ACTIVE"
},
"discoveryDocumentUri": "https://iam.googleapis.com/$discovery/rest",
"discoveryName": "WorkloadIdentityPool",
"location": "global",
"parent": "//cloudresourcemanager.googleapis.com/projects/610696529633",
"version": "v1"
},
"updateTime": "2025-10-31T21:11:14.364252682Z"
},
{
"ancestors": [
"projects/610696529633",
"organizations/777838403257"
],
"assetType": "iam.googleapis.com/WorkloadIdentityPoolProvider",
"name": "//iam.googleapis.com/projects/610696529633/locations/global/workloadIdentityPools/gg-asset-45050-bcd4/providers/gg-asset-45050-bcd4",
"resource": {
"data": {
"attributeCondition": "assertion.repository_owner == 'google'",
"attributeMapping": {
"attribute.actor": "assertion.actor",
"attribute.repository": "assertion.repository",
"google.subject": "assertion.sub"
},
"description": "OIDC provider for gg-asset-45050-bcd4",
"disabled": true,
"displayName": "gg-asset-45050-bcd4",
"name": "projects/610696529633/locations/global/workloadIdentityPools/gg-asset-45050-bcd4/providers/gg-asset-45050-bcd4",
"oidc": {
"issuerUri": "https://oidc.gg-asset-45050-bcd4.com"
},
"state": "ACTIVE"
},
"discoveryDocumentUri": "https://iam.googleapis.com/$discovery/rest",
"discoveryName": "WorkloadIdentityPoolProvider",
"location": "global",
"parent": "//iam.googleapis.com/projects/610696529633/locations/global/workloadIdentityPools/gg-asset-45050-bcd4",
"version": "v1"
},
"updateTime": "2025-10-31T21:11:27.175244045Z"
}
]--- END EXAMPLE 2 ---
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you for the feedback. I have added the new test case and combined the test files as you suggested. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| terraform { | ||
| required_providers { | ||
| google = { | ||
| source = "hashicorp/google" | ||
| version = ">= 4.54.0" | ||
| } | ||
| } | ||
| } | ||
|
|
||
| provider "google" { | ||
| project = "{{.Provider.project}}" | ||
| } | ||
|
|
||
| resource "google_iam_workload_identity_pool" "gg_asset_44602_7df7" { | ||
| project = "{{.Provider.project}}" | ||
| workload_identity_pool_id = "gg-asset-44602-7df7" | ||
| display_name = "gg-asset-44602-7df7" | ||
| description = "Workload Identity Pool for gg-asset-44602-7df7" | ||
| } | ||
|
|
||
| resource "google_iam_workload_identity_pool_provider" "gg_asset_44602_7df7" { | ||
| project = "{{.Provider.project}}" | ||
| workload_identity_pool_id = google_iam_workload_identity_pool.gg_asset_44602_7df7.workload_identity_pool_id | ||
| workload_identity_pool_provider_id = "gg-asset-44602-7df7" | ||
| display_name = "gg-asset-44602-7df7" | ||
| description = "AWS provider for gg-asset-44602-7df7" | ||
| aws { | ||
| account_id = "111111111111" | ||
| } | ||
| } |
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.
Remove this
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.
@google-labs-jules
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.
Thank you for the feedback. I have corrected the JSON file to match the expected output.