Skip to content

Commit

Permalink
Merge pull request #1329 from maqiuyujoyce/202403-alloydbcluster-mbur…
Browse files Browse the repository at this point in the history
…-issue

Set displayName to be mutable-but-unreadable in AlloyDBCluster
  • Loading branch information
google-oss-prow[bot] authored Mar 19, 2024
2 parents bd1977f + c075a0f commit 5cc5d01
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 16 deletions.
1 change: 1 addition & 0 deletions config/servicemappings/alloydb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ spec:
targetField: cluster_id
mutableButUnreadableFields:
- initial_user
- display_name
hierarchicalReferences:
- type: project
key: projectRef
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,15 @@ kind: AlloyDBCluster
metadata:
name: alloydbcluster-${uniqueId}
spec:
displayName: test alloydb cluster
location: us-central1
networkConfig:
networkRef:
name: default

projectRef:
external: ${projectId}

initialUser:
user: postgres
password:
value: postgres

resourceID: alloydbcluster${uniqueId}
resourceID: alloydbcluster${uniqueId}
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

#apiVersion: compute.cnrm.cloud.google.com/v1beta1
#kind: ComputeNetwork
#metadata:
# name: computenetwork-${uniqueId}
#spec:
# resourceID: computenetwork${uniqueId}

apiVersion: compute.cnrm.cloud.google.com/v1beta1
kind: ComputeNetwork
metadata:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ kind: AlloyDBCluster
metadata:
name: alloydbcluster-${uniqueId}
spec:
displayName: test alloydb cluster 2
location: us-central1
networkConfig:
networkRef:
name: default

projectRef:
external: ${projectId}
automatedBackupPolicy:
labels:
source: kcc-test
resourceID: alloydbcluster${uniqueId}
resourceID: alloydbcluster${uniqueId}
Original file line number Diff line number Diff line change
Expand Up @@ -721,9 +721,16 @@ func resourceAlloydbClusterRead(d *schema.ResourceData, meta interface{}) error
if err := d.Set("network_config", flattenAlloydbClusterNetworkConfig(res["networkConfig"], d, config)); err != nil {
return fmt.Errorf("Error reading Cluster: %s", err)
}
if err := d.Set("display_name", flattenAlloydbClusterDisplayName(res["displayName"], d, config)); err != nil {
return fmt.Errorf("Error reading Cluster: %s", err)
}
// Comment out the reading of the "display_name" field until the returned
// "displayName" contains the correct display name value.
// The returned "displayName" here is always an empty string so it is an
// incorrect reflection of the live state.
// Commenting it out so Config Connector can treat "displayName" as a
// mutable-but-unreadable field to correctly populate the value of it.
//
//if err := d.Set("display_name", flattenAlloydbClusterDisplayName(res["displayName"], d, config)); err != nil {
// return fmt.Errorf("Error reading Cluster: %s", err)
//}
if err := d.Set("database_version", flattenAlloydbClusterDatabaseVersion(res["databaseVersion"], d, config)); err != nil {
return fmt.Errorf("Error reading Cluster: %s", err)
}
Expand Down

0 comments on commit 5cc5d01

Please sign in to comment.