@@ -445,3 +445,141 @@ resource "google_pubsub_topic" "foo" {
445
445
}
446
446
` , topic )
447
447
}
448
+
449
+ func TestAccPubsubTopic_awsMskIngestionUpdate (t * testing.T ) {
450
+ t .Parallel ()
451
+
452
+ topic := fmt .Sprintf ("tf-test-topic-%s" , acctest .RandString (t , 10 ))
453
+
454
+ acctest .VcrTest (t , resource.TestCase {
455
+ PreCheck : func () { acctest .AccTestPreCheck (t ) },
456
+ ProtoV5ProviderFactories : acctest .ProtoV5ProviderFactories (t ),
457
+ CheckDestroy : testAccCheckPubsubTopicDestroyProducer (t ),
458
+ Steps : []resource.TestStep {
459
+ {
460
+ Config : testAccPubsubTopic_updateWithAwsMskIngestionSettings (topic ),
461
+ },
462
+ {
463
+ ResourceName : "google_pubsub_topic.foo" ,
464
+ ImportStateId : topic ,
465
+ ImportState : true ,
466
+ ImportStateVerify : true ,
467
+ },
468
+ {
469
+ Config : testAccPubsubTopic_updateWithUpdatedAwsMskIngestionSettings (topic ),
470
+ },
471
+ {
472
+ ResourceName : "google_pubsub_topic.foo" ,
473
+ ImportStateId : topic ,
474
+ ImportState : true ,
475
+ ImportStateVerify : true ,
476
+ },
477
+ },
478
+ })
479
+ }
480
+
481
+ func testAccPubsubTopic_updateWithAwsMskIngestionSettings (topic string ) string {
482
+ return fmt .Sprintf (`
483
+ resource "google_pubsub_topic" "foo" {
484
+ name = "%s"
485
+
486
+ # Outside of automated terraform-provider-google CI tests, these values must be of actual Cloud Storage resources for the test to pass.
487
+ ingestion_data_source_settings {
488
+ aws_msk {
489
+ cluster_arn = "arn:aws:kinesis:us-west-2:111111111111:stream/fake-stream-name"
490
+ topic = "test-topic"
491
+ aws_role_arn = "arn:aws:iam::111111111111:role/fake-role-name"
492
+ gcp_service_account = "[email protected] "
493
+ }
494
+ }
495
+ }
496
+ ` , topic )
497
+ }
498
+
499
+ func testAccPubsubTopic_updateWithUpdatedAwsMskIngestionSettings (topic string ) string {
500
+ return fmt .Sprintf (`
501
+ resource "google_pubsub_topic" "foo" {
502
+ name = "%s"
503
+
504
+ # Outside of automated terraform-provider-google CI tests, these values must be of actual Cloud Storage resources for the test to pass.
505
+ ingestion_data_source_settings {
506
+ aws_msk {
507
+ cluster_arn = "arn:aws:kinesis:us-west-2:111111111111:stream/fake-stream-name"
508
+ topic = "test-topic"
509
+ aws_role_arn = "arn:aws:iam::111111111111:role/fake-role-name"
510
+ gcp_service_account = "updated-fake-service-account@fake-gcp-project.iam.gserviceaccount.com"
511
+ }
512
+ }
513
+ }
514
+ ` , topic )
515
+ }
516
+
517
+ func TestAccPubsubTopic_confluentCloudIngestionUpdate (t * testing.T ) {
518
+ t .Parallel ()
519
+
520
+ topic := fmt .Sprintf ("tf-test-topic-%s" , acctest .RandString (t , 10 ))
521
+
522
+ acctest .VcrTest (t , resource.TestCase {
523
+ PreCheck : func () { acctest .AccTestPreCheck (t ) },
524
+ ProtoV5ProviderFactories : acctest .ProtoV5ProviderFactories (t ),
525
+ CheckDestroy : testAccCheckPubsubTopicDestroyProducer (t ),
526
+ Steps : []resource.TestStep {
527
+ {
528
+ Config : testAccPubsubTopic_updateWithConfluentCloudIngestionSettings (topic ),
529
+ },
530
+ {
531
+ ResourceName : "google_pubsub_topic.foo" ,
532
+ ImportStateId : topic ,
533
+ ImportState : true ,
534
+ ImportStateVerify : true ,
535
+ },
536
+ {
537
+ Config : testAccPubsubTopic_updateWithUpdatedConfluentCloudIngestionSettings (topic ),
538
+ },
539
+ {
540
+ ResourceName : "google_pubsub_topic.foo" ,
541
+ ImportStateId : topic ,
542
+ ImportState : true ,
543
+ ImportStateVerify : true ,
544
+ },
545
+ },
546
+ })
547
+ }
548
+
549
+ func testAccPubsubTopic_updateWithConfluentCloudIngestionSettings (topic string ) string {
550
+ return fmt .Sprintf (`
551
+ resource "google_pubsub_topic" "foo" {
552
+ name = "%s"
553
+
554
+ # Outside of automated terraform-provider-google CI tests, these values must be of actual Cloud Storage resources for the test to pass.
555
+ ingestion_data_source_settings {
556
+ confluent_cloud {
557
+ bootstrap_server = "test.us-west2.gcp.confluent.cloud:1111"
558
+ cluster_id = "1234"
559
+ topic = "test-topic"
560
+ identity_pool_id = "test-identity-pool-id"
561
+ gcp_service_account = "[email protected] "
562
+ }
563
+ }
564
+ }
565
+ ` , topic )
566
+ }
567
+
568
+ func testAccPubsubTopic_updateWithUpdatedConfluentCloudIngestionSettings (topic string ) string {
569
+ return fmt .Sprintf (`
570
+ resource "google_pubsub_topic" "foo" {
571
+ name = "%s"
572
+
573
+ # Outside of automated terraform-provider-google CI tests, these values must be of actual Cloud Storage resources for the test to pass.
574
+ ingestion_data_source_settings {
575
+ confluent_cloud {
576
+ bootstrap_server = "test.us-west2.gcp.confluent.cloud:1111"
577
+ cluster_id = "1234"
578
+ topic = "test-topic"
579
+ identity_pool_id = "test-identity-pool-id"
580
+ gcp_service_account = "updated-fake-service-account@fake-gcp-project.iam.gserviceaccount.com"
581
+ }
582
+ }
583
+ }
584
+ ` , topic )
585
+ }
0 commit comments