Skip to content

Commit

Permalink
adjust scope and function args
Browse files Browse the repository at this point in the history
  • Loading branch information
wyardley committed Sep 26, 2024
1 parent 058c4a9 commit da953fb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
15 changes: 4 additions & 11 deletions mmv1/third_party/terraform/services/container/node_config.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -1990,23 +1990,16 @@ func flattenHostMaintenancePolicy(c *container.HostMaintenancePolicy) []map[stri

// This portion of nodePoolUpdate() is moved here to be shared with
// node pool updates in `resource_container_cluster`
func nodePoolNodeConfigUpdate(d *schema.ResourceData, meta interface{}, nodePoolInfo *NodePoolInformation, prefix string, timeout time.Duration) error {
config := meta.(*transport_tpg.Config)
name := d.Get(prefix + "name").(string)
func nodePoolNodeConfigUpdate(d *schema.ResourceData, config *transport_tpg.Config, nodePoolInfo *NodePoolInformation, prefix, name string, timeout time.Duration) error {

// Nodepool write-lock will be acquired when update function is called.
npLockKey := nodePoolInfo.nodePoolLockKey(name)

userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent)
if err != nil {
return err
}

// Acquire read-lock on cluster.
clusterLockKey := nodePoolInfo.clusterLockKey()
transport_tpg.MutexStore.RLock(clusterLockKey)
defer transport_tpg.MutexStore.RUnlock(clusterLockKey)

// Nodepool write-lock will be acquired when update function is called.
npLockKey := nodePoolInfo.nodePoolLockKey(name)

if d.HasChange(prefix + "node_config") {

if d.HasChange(prefix + "node_config.0.logging_variant") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1411,7 +1411,7 @@ func nodePoolUpdate(d *schema.ResourceData, meta interface{}, nodePoolInfo *Node
}

if d.HasChange(prefix + "node_config") {
nodePoolNodeConfigUpdate(d, meta, nodePoolInfo, prefix, timeout)
nodePoolNodeConfigUpdate(d, config, nodePoolInfo, prefix, name, timeout)
}

if d.HasChange(prefix + "node_count") {
Expand Down

0 comments on commit da953fb

Please sign in to comment.