@@ -236,6 +236,34 @@ func TestAccContainerCluster_backend(t *testing.T) {
236
236
})
237
237
}
238
238
239
+ func TestAccContainerCluster_withLogging (t * testing.T ) {
240
+ clusterName := fmt .Sprintf ("cluster-test-%s" , acctest .RandString (10 ))
241
+
242
+ resource .Test (t , resource.TestCase {
243
+ PreCheck : func () { testAccPreCheck (t ) },
244
+ Providers : testAccProviders ,
245
+ CheckDestroy : testAccCheckContainerClusterDestroy ,
246
+ Steps : []resource.TestStep {
247
+ {
248
+ Config : testAccContainerCluster_withLogging (clusterName ),
249
+ Check : resource .ComposeTestCheckFunc (
250
+ testAccCheckContainerCluster (
251
+ "google_container_cluster.with_logging" ),
252
+ resource .TestCheckResourceAttr ("google_container_cluster.with_logging" , "logging_service" , "logging.googleapis.com" ),
253
+ ),
254
+ },
255
+ {
256
+ Config : testAccContainerCluster_updateLogging (clusterName ),
257
+ Check : resource .ComposeTestCheckFunc (
258
+ testAccCheckContainerCluster (
259
+ "google_container_cluster.with_logging" ),
260
+ resource .TestCheckResourceAttr ("google_container_cluster.with_logging" , "logging_service" , "none" ),
261
+ ),
262
+ },
263
+ },
264
+ })
265
+ }
266
+
239
267
func TestAccContainerCluster_withNodePoolBasic (t * testing.T ) {
240
268
resource .Test (t , resource.TestCase {
241
269
PreCheck : func () { testAccPreCheck (t ) },
@@ -838,6 +866,28 @@ resource "google_container_cluster" "primary" {
838
866
}
839
867
` , acctest .RandString (10 ), acctest .RandString (10 ), acctest .RandString (10 ))
840
868
869
+ func testAccContainerCluster_withLogging (clusterName string ) string {
870
+ return fmt .Sprintf (`
871
+ resource "google_container_cluster" "with_logging" {
872
+ name = "cluster-test-%s"
873
+ zone = "us-central1-a"
874
+ initial_node_count = 1
875
+
876
+ logging_service = "logging.googleapis.com"
877
+ }` , clusterName )
878
+ }
879
+
880
+ func testAccContainerCluster_updateLogging (clusterName string ) string {
881
+ return fmt .Sprintf (`
882
+ resource "google_container_cluster" "with_logging" {
883
+ name = "cluster-test-%s"
884
+ zone = "us-central1-a"
885
+ initial_node_count = 1
886
+
887
+ logging_service = "none"
888
+ }` , clusterName )
889
+ }
890
+
841
891
var testAccContainerCluster_withNodePoolBasic = fmt .Sprintf (`
842
892
resource "google_container_cluster" "with_node_pool" {
843
893
name = "tf-cluster-nodepool-test-%s"
0 commit comments