-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Biglake namespace resource #16280
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
Merged
melinath
merged 33 commits into
GoogleCloudPlatform:main
from
rambleraptor:namespace_resource
Feb 12, 2026
Merged
Biglake namespace resource #16280
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
1baa94b
Biglake namespace resource
rambleraptor e4c36ea
BigLake namespace resource
rambleraptor eb1f263
Save point
rambleraptor e187f92
Move to generated
rambleraptor a2068c7
fixes
rambleraptor 73c8e7f
lint
rambleraptor 0aa4ded
lint
rambleraptor d0a7d58
rebase issue
rambleraptor 9b0dc44
other missing file
rambleraptor 2400781
test fix
rambleraptor f1db933
test fixes
rambleraptor 54b70b6
remove handwritten
rambleraptor b59a816
test fix
rambleraptor f055207
let's try it
rambleraptor 5fe30f7
IAM policies need to send x-goog-user-project header
rambleraptor c60421b
test fixes
rambleraptor 1dd1dc7
wip
rambleraptor 0521caf
Test fixes
rambleraptor 3e618da
bad change
rambleraptor 4069b47
no longer needed
rambleraptor 73d3eaa
test fix
rambleraptor c83e820
Update mmv1/products/biglakeiceberg/IcebergNamespace.yaml
rambleraptor 5da930f
Update mmv1/third_party/terraform/services/biglakeiceberg/utils.go
rambleraptor 89c467d
Update mmv1/third_party/terraform/acctest/resource_inventory_test.go
rambleraptor 0f718b0
Update mmv1/api/resource/iam_policy.go
rambleraptor 3699e8b
address PR review
rambleraptor 119c650
Move to examples
rambleraptor 588a5cc
remove unused template
rambleraptor 1f98ab2
renaming things
rambleraptor 7f8beee
Update mmv1/products/biglakeiceberg/IcebergNamespace.yaml
rambleraptor 4103ac1
Update mmv1/api/resource/iam_policy.go
rambleraptor 43c2352
Update mmv1/products/biglakeiceberg/IcebergNamespace.yaml
rambleraptor 9ff5a65
stray changes
rambleraptor File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| # Copyright 2025 Google Inc. | ||
| # 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. | ||
|
|
||
| --- | ||
| name: 'IcebergNamespace' | ||
| description: | | ||
| IcebergNamespaces are containers for Apache Iceberg Tables within an IcebergCatalog. | ||
| supports_indirect_user_project_override: true | ||
| base_url: 'iceberg/v1/restcatalog/v1/projects/{{project}}/catalogs/{{catalog}}/namespaces' | ||
| self_link: 'iceberg/v1/restcatalog/v1/projects/{{project}}/catalogs/{{catalog}}/namespaces/{{namespace_id}}' | ||
| id_format: 'projects/{{project}}/catalogs/{{catalog}}/namespaces/{{namespace_id}}' | ||
| import_format: | ||
| - 'projects/{{project}}/catalogs/{{catalog}}/namespaces/{{namespace_id}}' | ||
| - '{{project}}/{{catalog}}/{{namespace_id}}' | ||
| - '{{catalog}}/{{namespace_id}}' | ||
| immutable: false | ||
| custom_code: | ||
| constants: 'templates/terraform/constants/biglake_iceberg_namespace.go.tmpl' | ||
| update_encoder: 'templates/terraform/encoders/biglake_iceberg_namespace.go.tmpl' | ||
| parameters: | ||
| - name: 'catalog' | ||
| type: String | ||
| required: true | ||
| immutable: true | ||
| url_param_only: true | ||
| description: | | ||
| The name of the IcebergCatalog. | ||
| properties: | ||
| - name: 'namespace_id' | ||
| api_name: 'namespace' | ||
| type: String | ||
| description: | | ||
| The unique identifier of the namespace. | ||
| required: true | ||
| immutable: true | ||
| custom_expand: 'templates/terraform/custom_expand/biglake_iceberg_namespace_id.go.tmpl' | ||
| custom_flatten: 'templates/terraform/custom_flatten/biglake_iceberg_namespace_id.go.tmpl' | ||
| - name: 'properties' | ||
| type: KeyValuePairs | ||
| description: | | ||
| User-defined properties for the namespace. | ||
| required: false | ||
| default_from_api: true | ||
| diff_suppress_func: 'icebergNamespacePropertiesDiffSuppress' | ||
| update_verb: 'POST' | ||
| update_url: 'iceberg/v1/restcatalog/v1/projects/{{project}}/catalogs/{{catalog}}/namespaces/{{namespace_id}}/properties' | ||
| iam_policy: | ||
| base_url: 'v1/projects/{{project}}/catalogs/{{catalog}}/namespaces/{{namespace_id}}' | ||
| parent_resource_attribute: 'namespace_id' | ||
| method_name_separator: ":" | ||
| fetch_iam_policy_verb: 'GET' | ||
| import_format: | ||
| - 'projects/{{project}}/catalogs/{{catalog}}/namespaces/{{namespace_id}}' | ||
rambleraptor marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - '{{namespace_id}}' | ||
| allowed_iam_role: 'roles/biglake.editor' | ||
| sample_config_body: 'templates/terraform/iam/example_config_body/biglake_iceberg_namespace.tf.tmpl' | ||
| examples: | ||
| - name: 'biglake_iceberg_namespace' | ||
| primary_resource_id: 'my_iceberg_namespace' | ||
| vars: | ||
| bucket_name: 'example-bucket' | ||
| test_env_vars: | ||
| GOOGLE_BILLING_PROJECT: 'PROJECT_NAME' | ||
| USER_PROJECT_OVERRIDE: 'true' | ||
12 changes: 12 additions & 0 deletions
12
mmv1/templates/terraform/constants/biglake_iceberg_namespace.go.tmpl
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| var icebergNamespaceIgnoredProperties = map[string]bool{ | ||
| "location": true, | ||
| } | ||
|
|
||
| func icebergNamespacePropertiesDiffSuppress(k, old, new string, d *schema.ResourceData) bool { | ||
| // properties.KEY | ||
| parts := strings.Split(k, ".") | ||
| if len(parts) == 2 && icebergNamespaceIgnoredProperties[parts[1]] { | ||
| return true | ||
| } | ||
| return false | ||
| } |
6 changes: 6 additions & 0 deletions
6
mmv1/templates/terraform/custom_expand/biglake_iceberg_namespace_id.go.tmpl
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { | ||
| if v == nil { | ||
| return nil, nil | ||
| } | ||
| return strings.Split(v.(string), "\x1f"), nil | ||
| } |
11 changes: 11 additions & 0 deletions
11
mmv1/templates/terraform/custom_flatten/biglake_iceberg_namespace_id.go.tmpl
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { | ||
| if v == nil { | ||
| return nil | ||
| } | ||
| parts := v.([]interface{}) | ||
| s := make([]string, len(parts)) | ||
| for i, p := range parts { | ||
| s[i] = p.(string) | ||
| } | ||
| return strings.Join(s, "\x1f") | ||
| } |
29 changes: 29 additions & 0 deletions
29
mmv1/templates/terraform/encoders/biglake_iceberg_namespace.go.tmpl
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| if d.HasChange("properties") { | ||
| oldProp, newProp := d.GetChange("properties") | ||
| oldMap := oldProp.(map[string]interface{}) | ||
| newMap := newProp.(map[string]interface{}) | ||
|
|
||
| removals := []string{} | ||
| for k := range oldMap { | ||
| if icebergNamespaceIgnoredProperties[k] { | ||
| continue | ||
| } | ||
| if _, ok := newMap[k]; !ok { | ||
| removals = append(removals, k) | ||
| } | ||
| } | ||
|
|
||
| updates := map[string]string{} | ||
| for k, v := range newMap { | ||
| if icebergNamespaceIgnoredProperties[k] { | ||
| continue | ||
| } | ||
| updates[k] = v.(string) | ||
| } | ||
|
|
||
| return map[string]interface{}{ | ||
| "removals": removals, | ||
| "updates": updates, | ||
| }, nil | ||
| } | ||
| return nil, nil |
19 changes: 19 additions & 0 deletions
19
mmv1/templates/terraform/examples/biglake_iceberg_namespace.tf.tmpl
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| resource "google_storage_bucket" "bucket" { | ||
| name = "{{index $.Vars "bucket_name"}}" | ||
| location = "us-central1" | ||
| force_destroy = true | ||
| uniform_bucket_level_access = true | ||
| } | ||
|
|
||
| resource "google_biglake_iceberg_catalog" "catalog" { | ||
| name = google_storage_bucket.bucket.name | ||
| catalog_type = "CATALOG_TYPE_GCS_BUCKET" | ||
| } | ||
|
|
||
| resource "google_biglake_iceberg_namespace" "{{$.PrimaryResourceId}}" { | ||
| catalog = google_biglake_iceberg_catalog.catalog.name | ||
| namespace_id = "{{$.PrimaryResourceId}}" | ||
| properties = { | ||
| key = "value" | ||
| } | ||
| } |
3 changes: 3 additions & 0 deletions
3
mmv1/templates/terraform/iam/example_config_body/biglake_iceberg_namespace.tf.tmpl
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| project = google_biglake_iceberg_namespace.my_iceberg_namespace.project | ||
| catalog = google_biglake_iceberg_namespace.my_iceberg_namespace.catalog | ||
| namespace_id = google_biglake_iceberg_namespace.my_iceberg_namespace.id |
This file contains hidden or 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
100 changes: 100 additions & 0 deletions
100
.../third_party/terraform/services/biglakeiceberg/resource_biglake_iceberg_namespace_test.go
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| // Copyright (c) HashiCorp, Inc. | ||
| // SPDX-License-Identifier: MPL-2.0 | ||
|
|
||
| package biglakeiceberg_test | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| "github.com/hashicorp/terraform-plugin-testing/helper/resource" | ||
| "github.com/hashicorp/terraform-plugin-testing/plancheck" | ||
|
|
||
| "github.com/hashicorp/terraform-provider-google/google/acctest" | ||
| ) | ||
|
|
||
| func TestAccBiglakeIcebergIcebergNamespace_update(t *testing.T) { | ||
| t.Parallel() | ||
|
|
||
| context := map[string]interface{}{ | ||
| "bucket_suffix": acctest.RandString(t, 10), | ||
| } | ||
|
|
||
| acctest.VcrTest(t, resource.TestCase{ | ||
| PreCheck: func() { acctest.AccTestPreCheck(t) }, | ||
| ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), | ||
| CheckDestroy: testAccCheckBiglakeIcebergIcebergNamespaceDestroyProducer(t), | ||
| Steps: []resource.TestStep{ | ||
| { | ||
| Config: testAccBiglakeIcebergIcebergNamespace_updateInitial(context), | ||
| }, | ||
| { | ||
| ResourceName: "google_biglake_iceberg_namespace.my_iceberg_namespace", | ||
| ImportState: true, | ||
| ImportStateVerify: true, | ||
| ImportStateVerifyIgnore: []string{"catalog"}, | ||
| }, | ||
| { | ||
| Config: testAccBiglakeIcebergIcebergNamespace_updateUpdated(context), | ||
| ConfigPlanChecks: resource.ConfigPlanChecks{ | ||
| PreApply: []plancheck.PlanCheck{ | ||
| plancheck.ExpectResourceAction("google_biglake_iceberg_namespace.my_iceberg_namespace", plancheck.ResourceActionUpdate), | ||
| }, | ||
| }, | ||
| }, | ||
| { | ||
| ResourceName: "google_biglake_iceberg_namespace.my_iceberg_namespace", | ||
| ImportState: true, | ||
| ImportStateVerify: true, | ||
| ImportStateVerifyIgnore: []string{"catalog"}, | ||
| }, | ||
| }, | ||
| }) | ||
| } | ||
|
|
||
| func testAccBiglakeIcebergIcebergNamespace_updateInitial(context map[string]interface{}) string { | ||
| return acctest.Nprintf(` | ||
| resource "google_storage_bucket" "bucket" { | ||
| name = "my-bucket-%{bucket_suffix}" | ||
| location = "us-central1" | ||
| force_destroy = true | ||
| uniform_bucket_level_access = true | ||
| } | ||
|
|
||
| resource "google_biglake_iceberg_catalog" "catalog" { | ||
| name = google_storage_bucket.bucket.name | ||
| catalog_type = "CATALOG_TYPE_GCS_BUCKET" | ||
| } | ||
|
|
||
| resource "google_biglake_iceberg_namespace" "my_iceberg_namespace" { | ||
| catalog = google_biglake_iceberg_catalog.catalog.name | ||
| namespace_id = "my-namespace-%{bucket_suffix}" | ||
| properties = { | ||
| key = "initial" | ||
| } | ||
| } | ||
| `, context) | ||
| } | ||
|
|
||
| func testAccBiglakeIcebergIcebergNamespace_updateUpdated(context map[string]interface{}) string { | ||
| return acctest.Nprintf(` | ||
| resource "google_storage_bucket" "bucket" { | ||
| name = "my-bucket-%{bucket_suffix}" | ||
| location = "us-central1" | ||
| force_destroy = true | ||
| uniform_bucket_level_access = true | ||
| } | ||
|
|
||
| resource "google_biglake_iceberg_catalog" "catalog" { | ||
| name = google_storage_bucket.bucket.name | ||
| catalog_type = "CATALOG_TYPE_GCS_BUCKET" | ||
| } | ||
|
|
||
| resource "google_biglake_iceberg_namespace" "my_iceberg_namespace" { | ||
| catalog = google_biglake_iceberg_catalog.catalog.name | ||
| namespace_id = "my-namespace-%{bucket_suffix}" | ||
| properties = { | ||
| key = "updated" | ||
| } | ||
| } | ||
| `, context) | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.