Skip to content

Commit 40dece5

Browse files
Add in performance_monitoring_unit for advanced_machine_features in node_config (#14144) (#23260)
[upstream:9aa40608b892251ce9ed80ffef047ca7ab061e88] Signed-off-by: Modular Magician <[email protected]>
1 parent 9add4d3 commit 40dece5

File tree

7 files changed

+196
-33
lines changed

7 files changed

+196
-33
lines changed

.changelog/14144.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
container: added 'performance_monitoring_unit' in node_config/advanced_machine_features to 'google_container_cluster' resource
3+
```

go.mod

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ module github.com/hashicorp/terraform-provider-google
33
go 1.23.0
44

55
require (
6+
cloud.google.com/go/auth v0.16.1
7+
cloud.google.com/go/auth/oauth2adapt v0.2.8
68
cloud.google.com/go/bigtable v1.37.0
79
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.79.0
810
github.com/apparentlymart/go-cidr v1.1.0
@@ -32,22 +34,21 @@ require (
3234
golang.org/x/exp v0.0.0-20240409090435-93d18d7e34b8
3335
golang.org/x/net v0.40.0
3436
golang.org/x/oauth2 v0.30.0
35-
google.golang.org/api v0.233.0
36-
google.golang.org/genproto/googleapis/rpc v0.0.0-20250505200425-f936aa4a68b2
37-
google.golang.org/grpc v1.72.0
37+
google.golang.org/api v0.235.0
38+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250512202823-5a2f75b736a9
39+
google.golang.org/grpc v1.72.1
3840
google.golang.org/protobuf v1.36.6
41+
gopkg.in/yaml.v2 v2.4.0
3942
)
4043

4144
require (
4245
bitbucket.org/creachadair/stringset v0.0.8 // indirect
4346
cel.dev/expr v0.20.0 // indirect
4447
cloud.google.com/go v0.120.0 // indirect
45-
cloud.google.com/go/auth v0.16.1 // indirect
46-
cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect
47-
cloud.google.com/go/compute/metadata v0.6.0 // indirect
48-
cloud.google.com/go/iam v1.5.0 // indirect
49-
cloud.google.com/go/longrunning v0.6.6 // indirect
50-
cloud.google.com/go/monitoring v1.24.1 // indirect
48+
cloud.google.com/go/compute/metadata v0.7.0 // indirect
49+
cloud.google.com/go/iam v1.5.2 // indirect
50+
cloud.google.com/go/longrunning v0.6.7 // indirect
51+
cloud.google.com/go/monitoring v1.24.2 // indirect
5152
github.com/ProtonMail/go-crypto v1.1.3 // indirect
5253
github.com/agext/levenshtein v1.2.2 // indirect
5354
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
@@ -69,7 +70,7 @@ require (
6970
github.com/google/s2a-go v0.1.9 // indirect
7071
github.com/google/uuid v1.6.0 // indirect
7172
github.com/googleapis/enterprise-certificate-proxy v0.3.6 // indirect
72-
github.com/googleapis/gax-go/v2 v2.14.1 // indirect
73+
github.com/googleapis/gax-go/v2 v2.14.2 // indirect
7374
github.com/hashicorp/go-checkpoint v0.5.0 // indirect
7475
github.com/hashicorp/go-hclog v1.6.3 // indirect
7576
github.com/hashicorp/go-plugin v1.6.2 // indirect
@@ -115,8 +116,7 @@ require (
115116
golang.org/x/time v0.11.0 // indirect
116117
golang.org/x/tools v0.22.0 // indirect
117118
google.golang.org/appengine v1.6.8 // indirect
118-
google.golang.org/genproto v0.0.0-20250303144028-a0af3efb3deb // indirect
119-
google.golang.org/genproto/googleapis/api v0.0.0-20250414145226-207652e42e2e // indirect
120-
gopkg.in/yaml.v2 v2.4.0 // indirect
119+
google.golang.org/genproto v0.0.0-20250505200425-f936aa4a68b2 // indirect
120+
google.golang.org/genproto/googleapis/api v0.0.0-20250505200425-f936aa4a68b2 // indirect
121121
gopkg.in/yaml.v3 v3.0.1 // indirect
122122
)

go.sum

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ cloud.google.com/go/auth/oauth2adapt v0.2.8 h1:keo8NaayQZ6wimpNSmW5OPc283g65QNIi
1111
cloud.google.com/go/auth/oauth2adapt v0.2.8/go.mod h1:XQ9y31RkqZCcwJWNSx2Xvric3RrU88hAYYbjDWYDL+c=
1212
cloud.google.com/go/bigtable v1.37.0 h1:Q+x7y04lQ0B+WXp03wc1/FLhFt4CwcQdkwWT0M4Jp3w=
1313
cloud.google.com/go/bigtable v1.37.0/go.mod h1:HXqddP6hduwzrtiTCqZPpj9ij4hGZb4Zy1WF/dT+yaU=
14-
cloud.google.com/go/compute/metadata v0.6.0 h1:A6hENjEsCDtC1k8byVsgwvVcioamEHvZ4j01OwKxG9I=
15-
cloud.google.com/go/compute/metadata v0.6.0/go.mod h1:FjyFAW1MW0C203CEOMDTu3Dk1FlqW3Rga40jzHL4hfg=
16-
cloud.google.com/go/iam v1.5.0 h1:QlLcVMhbLGOjRcGe6VTGGTyQib8dRLK2B/kYNV0+2xs=
17-
cloud.google.com/go/iam v1.5.0/go.mod h1:U+DOtKQltF/LxPEtcDLoobcsZMilSRwR7mgNL7knOpo=
18-
cloud.google.com/go/longrunning v0.6.6 h1:XJNDo5MUfMM05xK3ewpbSdmt7R2Zw+aQEMbdQR65Rbw=
19-
cloud.google.com/go/longrunning v0.6.6/go.mod h1:hyeGJUrPHcx0u2Uu1UFSoYZLn4lkMrccJig0t4FI7yw=
20-
cloud.google.com/go/monitoring v1.24.1 h1:vKiypZVFD/5a3BbQMvI4gZdl8445ITzXFh257XBgrS0=
21-
cloud.google.com/go/monitoring v1.24.1/go.mod h1:Z05d1/vn9NaujqY2voG6pVQXoJGbp+r3laV+LySt9K0=
14+
cloud.google.com/go/compute/metadata v0.7.0 h1:PBWF+iiAerVNe8UCHxdOt6eHLVc3ydFeOCw78U8ytSU=
15+
cloud.google.com/go/compute/metadata v0.7.0/go.mod h1:j5MvL9PprKL39t166CoB1uVHfQMs4tFQZZcKwksXUjo=
16+
cloud.google.com/go/iam v1.5.2 h1:qgFRAGEmd8z6dJ/qyEchAuL9jpswyODjA2lS+w234g8=
17+
cloud.google.com/go/iam v1.5.2/go.mod h1:SE1vg0N81zQqLzQEwxL2WI6yhetBdbNQuTvIKCSkUHE=
18+
cloud.google.com/go/longrunning v0.6.7 h1:IGtfDWHhQCgCjwQjV9iiLnUta9LBCo8R9QmAFsS/PrE=
19+
cloud.google.com/go/longrunning v0.6.7/go.mod h1:EAFV3IZAKmM56TyiE6VAP3VoTzhZzySwI/YI1s/nRsY=
20+
cloud.google.com/go/monitoring v1.24.2 h1:5OTsoJ1dXYIiMiuL+sYscLc9BumrL3CarVLL7dd7lHM=
21+
cloud.google.com/go/monitoring v1.24.2/go.mod h1:x7yzPWcgDRnPEv3sI+jJGBkwl5qINf+6qY4eq0I9B4U=
2222
dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk=
2323
dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk=
2424
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
@@ -128,8 +128,8 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
128128
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
129129
github.com/googleapis/enterprise-certificate-proxy v0.3.6 h1:GW/XbdyBFQ8Qe+YAmFU9uHLo7OnF5tL52HFAgMmyrf4=
130130
github.com/googleapis/enterprise-certificate-proxy v0.3.6/go.mod h1:MkHOF77EYAE7qfSuSS9PU6g4Nt4e11cnsDUowfwewLA=
131-
github.com/googleapis/gax-go/v2 v2.14.1 h1:hb0FFeiPaQskmvakKu5EbCbpntQn48jyHuvrkurSS/Q=
132-
github.com/googleapis/gax-go/v2 v2.14.1/go.mod h1:Hb/NubMaVM88SrNkvl8X/o8XWwDJEPqouaLeN2IUxoA=
131+
github.com/googleapis/gax-go/v2 v2.14.2 h1:eBLnkZ9635krYIPD+ag1USrOAI0Nr0QYF3+/3GqO0k0=
132+
github.com/googleapis/gax-go/v2 v2.14.2/go.mod h1:ON64QhlJkhVtSqp4v1uaK92VyZ2gmvDQsweuyLV+8+w=
133133
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw=
134134
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y=
135135
github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA=
@@ -381,28 +381,28 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T
381381
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
382382
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
383383
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
384-
google.golang.org/api v0.233.0 h1:iGZfjXAJiUFSSaekVB7LzXl6tRfEKhUN7FkZN++07tI=
385-
google.golang.org/api v0.233.0/go.mod h1:TCIVLLlcwunlMpZIhIp7Ltk77W+vUSdUKAAIlbxY44c=
384+
google.golang.org/api v0.235.0 h1:C3MkpQSRxS1Jy6AkzTGKKrpSCOd2WOGrezZ+icKSkKo=
385+
google.golang.org/api v0.235.0/go.mod h1:QpeJkemzkFKe5VCE/PMv7GsUfn9ZF+u+q1Q7w6ckxTg=
386386
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
387387
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
388388
google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM=
389389
google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds=
390390
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
391391
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
392392
google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
393-
google.golang.org/genproto v0.0.0-20250303144028-a0af3efb3deb h1:ITgPrl429bc6+2ZraNSzMDk3I95nmQln2fuPstKwFDE=
394-
google.golang.org/genproto v0.0.0-20250303144028-a0af3efb3deb/go.mod h1:sAo5UzpjUwgFBCzupwhcLcxHVDK7vG5IqI30YnwX2eE=
395-
google.golang.org/genproto/googleapis/api v0.0.0-20250414145226-207652e42e2e h1:UdXH7Kzbj+Vzastr5nVfccbmFsmYNygVLSPk1pEfDoY=
396-
google.golang.org/genproto/googleapis/api v0.0.0-20250414145226-207652e42e2e/go.mod h1:085qFyf2+XaZlRdCgKNCIZ3afY2p4HHZdoIRpId8F4A=
397-
google.golang.org/genproto/googleapis/rpc v0.0.0-20250505200425-f936aa4a68b2 h1:IqsN8hx+lWLqlN+Sc3DoMy/watjofWiU8sRFgQ8fhKM=
398-
google.golang.org/genproto/googleapis/rpc v0.0.0-20250505200425-f936aa4a68b2/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A=
393+
google.golang.org/genproto v0.0.0-20250505200425-f936aa4a68b2 h1:1tXaIXCracvtsRxSBsYDiSBN0cuJvM7QYW+MrpIRY78=
394+
google.golang.org/genproto v0.0.0-20250505200425-f936aa4a68b2/go.mod h1:49MsLSx0oWMOZqcpB3uL8ZOkAh1+TndpJ8ONoCBWiZk=
395+
google.golang.org/genproto/googleapis/api v0.0.0-20250505200425-f936aa4a68b2 h1:vPV0tzlsK6EzEDHNNH5sa7Hs9bd7iXR7B1tSiPepkV0=
396+
google.golang.org/genproto/googleapis/api v0.0.0-20250505200425-f936aa4a68b2/go.mod h1:pKLAc5OolXC3ViWGI62vvC0n10CpwAtRcTNCFwTKBEw=
397+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250512202823-5a2f75b736a9 h1:IkAfh6J/yllPtpYFU0zZN1hUPYdT0ogkBT/9hMxHjvg=
398+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250512202823-5a2f75b736a9/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A=
399399
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
400400
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
401401
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
402402
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
403403
google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk=
404-
google.golang.org/grpc v1.72.0 h1:S7UkcVa60b5AAQTaO6ZKamFp1zMZSU0fGDK2WZLbBnM=
405-
google.golang.org/grpc v1.72.0/go.mod h1:wH5Aktxcg25y1I3w7H69nHfXdOG3UiadoBtjh3izSDM=
404+
google.golang.org/grpc v1.72.1 h1:HR03wO6eyZ7lknl75XlxABNVLLFc2PAb6mHlYh756mA=
405+
google.golang.org/grpc v1.72.1/go.mod h1:wH5Aktxcg25y1I3w7H69nHfXdOG3UiadoBtjh3izSDM=
406406
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
407407
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
408408
google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY=

google/services/container/node_config.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ import (
2727
"github.com/hashicorp/terraform-provider-google/google/tpgresource"
2828
transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport"
2929

30+
"github.com/hashicorp/terraform-provider-google/google/verify"
31+
3032
"google.golang.org/api/container/v1"
3133
)
3234

@@ -725,6 +727,12 @@ func schemaNodeConfig() *schema.Schema {
725727
ForceNew: true,
726728
Description: `Whether the node should have nested virtualization enabled.`,
727729
},
730+
"performance_monitoring_unit": {
731+
Type: schema.TypeString,
732+
Optional: true,
733+
ValidateFunc: verify.ValidateEnum([]string{"ARCHITECTURAL", "STANDARD", "ENHANCED"}),
734+
Description: `Level of Performance Monitoring Unit (PMU) requested. If unset, no access to the PMU is assumed.`,
735+
},
728736
},
729737
},
730738
},
@@ -1208,6 +1216,7 @@ func expandNodeConfig(v interface{}) *container.NodeConfig {
12081216
nc.AdvancedMachineFeatures = &container.AdvancedMachineFeatures{
12091217
ThreadsPerCore: int64(advanced_machine_features["threads_per_core"].(int)),
12101218
EnableNestedVirtualization: advanced_machine_features["enable_nested_virtualization"].(bool),
1219+
PerformanceMonitoringUnit: advanced_machine_features["performance_monitoring_unit"].(string),
12111220
}
12121221
}
12131222

@@ -1665,6 +1674,7 @@ func flattenAdvancedMachineFeaturesConfig(c *container.AdvancedMachineFeatures)
16651674
result = append(result, map[string]interface{}{
16661675
"threads_per_core": c.ThreadsPerCore,
16671676
"enable_nested_virtualization": c.EnableNestedVirtualization,
1677+
"performance_monitoring_unit": c.PerformanceMonitoringUnit,
16681678
})
16691679
}
16701680
return result

google/services/container/resource_container_cluster_test.go

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12871,6 +12871,92 @@ resource "google_container_cluster" "primary" {
1287112871
`, clusterName, networkName, subnetworkName)
1287212872
}
1287312873

12874+
func TestAccContainerCluster_withAdvancedMachineFeaturesPMU_Standard(t *testing.T) {
12875+
t.Parallel()
12876+
12877+
suffix := acctest.RandString(t, 10)
12878+
clusterResourceName := "google_container_cluster.primary"
12879+
clusterName := fmt.Sprintf("tf-test-cluster-%s", suffix)
12880+
networkName := fmt.Sprintf("test-network-%s", suffix)
12881+
subnetworkName := fmt.Sprintf("test-subnetwork-%s", suffix)
12882+
12883+
acctest.VcrTest(t, resource.TestCase{
12884+
PreCheck: func() { acctest.AccTestPreCheck(t) },
12885+
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
12886+
CheckDestroy: testAccCheckContainerClusterDestroyProducer(t),
12887+
Steps: []resource.TestStep{
12888+
{
12889+
Config: testAccContainerCluster_withAdvancedMachineFeaturesPMU(clusterName, networkName, subnetworkName, "STANDARD"),
12890+
},
12891+
{
12892+
ResourceName: clusterResourceName,
12893+
ImportState: true,
12894+
ImportStateVerify: true,
12895+
ImportStateVerifyIgnore: []string{"deletion_protection"},
12896+
},
12897+
},
12898+
})
12899+
}
12900+
12901+
func TestAccContainerCluster_withAdvancedMachineFeaturesPMU_Architectural(t *testing.T) {
12902+
t.Parallel()
12903+
12904+
suffix := acctest.RandString(t, 10)
12905+
clusterResourceName := "google_container_cluster.primary"
12906+
clusterName := fmt.Sprintf("tf-test-cluster-%s", suffix)
12907+
networkName := fmt.Sprintf("test-network-%s", suffix)
12908+
subnetworkName := fmt.Sprintf("test-subnetwork-%s", suffix)
12909+
12910+
acctest.VcrTest(t, resource.TestCase{
12911+
PreCheck: func() { acctest.AccTestPreCheck(t) },
12912+
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
12913+
CheckDestroy: testAccCheckContainerClusterDestroyProducer(t),
12914+
Steps: []resource.TestStep{
12915+
{
12916+
Config: testAccContainerCluster_withAdvancedMachineFeaturesPMU(clusterName, networkName, subnetworkName, "ARCHITECTURAL"),
12917+
},
12918+
{
12919+
ResourceName: clusterResourceName,
12920+
ImportState: true,
12921+
ImportStateVerify: true,
12922+
ImportStateVerifyIgnore: []string{"deletion_protection"},
12923+
},
12924+
},
12925+
})
12926+
}
12927+
12928+
func testAccContainerCluster_withAdvancedMachineFeaturesPMU(clusterName, networkName, subnetworkName, pmuLevel string) string {
12929+
return fmt.Sprintf(`
12930+
resource "google_compute_network" "default" {
12931+
name = "%s"
12932+
auto_create_subnetworks = false
12933+
}
12934+
12935+
resource "google_compute_subnetwork" "default" {
12936+
name = "%s"
12937+
network = google_compute_network.default.name
12938+
ip_cidr_range = "10.9.0.0/16"
12939+
region = "us-central1"
12940+
}
12941+
12942+
resource "google_container_cluster" "primary" {
12943+
name = "%s"
12944+
location = "us-central1-a"
12945+
initial_node_count = 1
12946+
network = google_compute_network.default.name
12947+
subnetwork = google_compute_subnetwork.default.name
12948+
deletion_protection = false
12949+
node_config {
12950+
machine_type = "c4-standard-2"
12951+
advanced_machine_features {
12952+
threads_per_core = 2
12953+
performance_monitoring_unit = "%s"
12954+
}
12955+
}
12956+
}
12957+
`, networkName, subnetworkName, clusterName, pmuLevel)
12958+
}
12959+
1287412960
func testAccContainerCluster_inTransitEncryptionConfig(name, networkName, subnetworkName, config string) string {
1287512961
return fmt.Sprintf(`
1287612962
resource "google_container_cluster" "primary" {

google/services/container/resource_container_node_pool_test.go

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2362,6 +2362,68 @@ resource "google_container_node_pool" "np" {
23622362
`, cluster, networkName, subnetworkName, enableNV, np, enableNV)
23632363
}
23642364

2365+
func TestAccContainerNodePool_performanceMonitoringUnit(t *testing.T) {
2366+
t.Parallel()
2367+
2368+
cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10))
2369+
np := fmt.Sprintf("tf-test-nodepool-%s", acctest.RandString(t, 10))
2370+
networkName := acctest.BootstrapSharedTestNetwork(t, "gke-cluster")
2371+
subnetworkName := acctest.BootstrapSubnet(t, "gke-cluster", networkName)
2372+
2373+
acctest.VcrTest(t, resource.TestCase{
2374+
PreCheck: func() { acctest.AccTestPreCheck(t) },
2375+
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
2376+
CheckDestroy: testAccCheckContainerNodePoolDestroyProducer(t),
2377+
Steps: []resource.TestStep{
2378+
{
2379+
Config: testAccContainerNodePool_performanceMonitoringUnit(cluster, np, networkName, subnetworkName, "ARCHITECTURAL"),
2380+
},
2381+
{
2382+
ResourceName: "google_container_cluster.cluster",
2383+
ImportState: true,
2384+
ImportStateVerify: true,
2385+
ImportStateVerifyIgnore: []string{"deletion_protection"},
2386+
},
2387+
},
2388+
})
2389+
}
2390+
2391+
func testAccContainerNodePool_performanceMonitoringUnit(cluster, np, networkName, subnetworkName, pmuLevel string) string {
2392+
return fmt.Sprintf(`
2393+
resource "google_container_cluster" "cluster" {
2394+
name = "%s"
2395+
location = "us-central1-a"
2396+
initial_node_count = 1
2397+
deletion_protection = false
2398+
network = "%s"
2399+
subnetwork = "%s"
2400+
2401+
node_config {
2402+
machine_type = "c4-standard-4"
2403+
advanced_machine_features {
2404+
threads_per_core = 2
2405+
performance_monitoring_unit = "%s"
2406+
}
2407+
}
2408+
}
2409+
2410+
resource "google_container_node_pool" "np" {
2411+
name = "%s"
2412+
location = "us-central1-a"
2413+
cluster = google_container_cluster.cluster.name
2414+
initial_node_count = 2
2415+
2416+
node_config {
2417+
machine_type = "c4-standard-4"
2418+
advanced_machine_features {
2419+
threads_per_core = 2
2420+
performance_monitoring_unit = "%s"
2421+
}
2422+
}
2423+
}
2424+
`, cluster, networkName, subnetworkName, pmuLevel, np, pmuLevel)
2425+
}
2426+
23652427
func testAccCheckContainerNodePoolDestroyProducer(t *testing.T) func(s *terraform.State) error {
23662428
return func(s *terraform.State) error {
23672429
config := acctest.GoogleProviderConfig(t)

website/docs/r/container_cluster.html.markdown

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,6 +1080,8 @@ sole_tenant_config {
10801080

10811081
* `enable_nested_virtualization`- (Optional) Defines whether the instance should have nested virtualization enabled. Defaults to false.
10821082

1083+
* `performance_monitoring_unit` - (Optional) Defines the performance monitoring unit [PMU](https://cloud.google.com/compute/docs/pmu-overview) level. Valid values are `ARCHITECTURAL`, `STANDARD`, or `ENHANCED`. Defaults to off.
1084+
10831085
<a name="nested_ephemeral_storage_config"></a>The `ephemeral_storage_config` block supports:
10841086

10851087
* `local_ssd_count` (Required) - Number of local SSDs to use to back ephemeral storage. Uses NVMe interfaces. Each local SSD is 375 GB in size. If zero, it means to disable using local SSDs as ephemeral storage.

0 commit comments

Comments
 (0)