@@ -38,6 +38,44 @@ func TestAccCloudProviderAccessAuthorizationAzure_basic(t *testing.T) {
38
38
)
39
39
}
40
40
41
+ func TestAccCloudProviderAccessAuthorizationGCP_basic (t * testing.T ) {
42
+ var (
43
+ resourceName = "mongodbatlas_cloud_provider_access_authorization.this"
44
+ projectID = acc .ProjectIDExecution (t )
45
+ )
46
+
47
+ resource .Test (t , resource.TestCase {
48
+ PreCheck : func () { acc .PreCheckBasic (t ) },
49
+ ProtoV6ProviderFactories : acc .TestAccProviderV6Factories ,
50
+ CheckDestroy : checkDestroy ,
51
+ Steps : []resource.TestStep {
52
+ {
53
+ Config : configAuthorizationGCP (projectID ),
54
+ Check : resource .ComposeAggregateTestCheckFunc (
55
+ checkExists (resourceName ),
56
+ resource .TestCheckResourceAttr (resourceName , "project_id" , projectID ),
57
+ resource .TestCheckResourceAttrSet (resourceName , "role_id" ),
58
+ resource .TestCheckResourceAttrSet (resourceName , "gcp.0.service_account_for_atlas" ),
59
+ ),
60
+ },
61
+ },
62
+ })
63
+ }
64
+
65
+ func configAuthorizationGCP (projectID string ) string {
66
+ return fmt .Sprintf (`
67
+ resource "mongodbatlas_cloud_provider_access_setup" "gcp_setup" {
68
+ project_id = %[1]q
69
+ provider_name = "GCP"
70
+ }
71
+
72
+ resource "mongodbatlas_cloud_provider_access_authorization" "this" {
73
+ project_id = mongodbatlas_cloud_provider_access_setup.gcp_setup.project_id
74
+ role_id = mongodbatlas_cloud_provider_access_setup.gcp_setup.role_id
75
+ }
76
+ ` , projectID )
77
+ }
78
+
41
79
func basicAuthorizationTestCase (tb testing.TB ) * resource.TestCase {
42
80
tb .Helper ()
43
81
0 commit comments