dttung2905 commented on code in PR #16: URL: https://github.com/apache/iceberg-terraform/pull/16#discussion_r2956383562
########## internal/provider/resource_polaris_principal.go: ########## @@ -0,0 +1,354 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You 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. + +package provider + +import ( + "context" + "errors" + + "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/path" + "github.com/hashicorp/terraform-plugin-framework/resource" + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/booldefault" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-log/tflog" +) + +var ( + _ resource.Resource = &polarisPrincipalResource{} + _ resource.ResourceWithImportState = &polarisPrincipalResource{} +) + +func NewPolarisPrincipalResource() resource.Resource { + return &polarisPrincipalResource{} +} + +type polarisPrincipalResource struct { + provider *icebergProvider + client *polarisClient +} + +type polarisPrincipalResourceModel struct { + ID types.String `tfsdk:"id"` + Name types.String `tfsdk:"name"` + Properties types.Map `tfsdk:"properties"` + CredentialRotationRequired types.Bool `tfsdk:"credential_rotation_required"` + ClientID types.String `tfsdk:"client_id"` + ClientSecret types.String `tfsdk:"client_secret"` Review Comment: Hi @flyrain thanks for the review. `client_secret/client_id` are Computed outputs only; users can’t set them via Terraform configuration. On `update`, Polaris doesn’t return credentials and the only way to change the secret is via the dedicated resetCredentials endpoint after creation. So the provider does not attempt to modify/rotate the secret during Update; it preserves the previously stored secret from state. I have also made some changes to reflect your feedback into the code -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
