Skip to content

Commit 4e9330a

Browse files
Fixed GA NetworkSecurity tests (#10656)
[upstream:636d31676ab74cd9d4c48bdb4725a89f5dd6e9d7] Signed-off-by: Modular Magician <magic-modules@google.com>
1 parent 193b08b commit 4e9330a

8 files changed

+17
-42
lines changed

google/services/networksecurity/resource_network_security_firewall_endpoint_association_test.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func TestAccNetworkSecurityFirewallEndpointAssociations_basic(t *testing.T) {
3131

3232
acctest.VcrTest(t, resource.TestCase{
3333
PreCheck: func() { acctest.AccTestPreCheck(t) },
34-
ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t),
34+
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
3535
CheckDestroy: testAccCheckNetworkSecurityFirewallEndpointDestroyProducer(t),
3636
Steps: []resource.TestStep{
3737
{
@@ -69,7 +69,7 @@ func TestAccNetworkSecurityFirewallEndpointAssociations_disabled(t *testing.T) {
6969

7070
acctest.VcrTest(t, resource.TestCase{
7171
PreCheck: func() { acctest.AccTestPreCheck(t) },
72-
ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t),
72+
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
7373
CheckDestroy: testAccCheckNetworkSecurityFirewallEndpointDestroyProducer(t),
7474
Steps: []resource.TestStep{
7575
{
@@ -120,13 +120,11 @@ func testContextMapDisabledField(context map[string]interface{}, disabled bool)
120120
func testAccNetworkSecurityFirewallEndpointAssociation_basic(context map[string]interface{}) string {
121121
return acctest.Nprintf(`
122122
resource "google_compute_network" "foobar" {
123-
provider = google-beta
124123
name = "tf-test-my-vpc%{randomSuffix}"
125124
auto_create_subnetworks = false
126125
}
127126
128127
resource "google_network_security_firewall_endpoint" "foobar" {
129-
provider = google-beta
130128
name = "tf-test-my-firewall-endpoint%{randomSuffix}"
131129
parent = "organizations/%{orgId}"
132130
location = "us-central1-a"
@@ -135,7 +133,6 @@ resource "google_network_security_firewall_endpoint" "foobar" {
135133
136134
# TODO: add tlsInspectionPolicy once resource is ready
137135
resource "google_network_security_firewall_endpoint_association" "foobar" {
138-
provider = google-beta
139136
name = "tf-test-my-firewall-endpoint-association%{randomSuffix}"
140137
parent = "projects/%{billingProjectId}"
141138
location = "us-central1-a"
@@ -152,13 +149,11 @@ resource "google_network_security_firewall_endpoint_association" "foobar" {
152149
func testAccNetworkSecurityFirewallEndpointAssociation_update(context map[string]interface{}) string {
153150
return acctest.Nprintf(`
154151
resource "google_compute_network" "foobar" {
155-
provider = google-beta
156152
name = "tf-test-my-vpc%{randomSuffix}"
157153
auto_create_subnetworks = false
158154
}
159155
160156
resource "google_network_security_firewall_endpoint" "foobar" {
161-
provider = google-beta
162157
name = "tf-test-my-firewall-endpoint%{randomSuffix}"
163158
parent = "organizations/%{orgId}"
164159
location = "us-central1-a"
@@ -167,7 +162,6 @@ resource "google_network_security_firewall_endpoint" "foobar" {
167162
168163
# TODO: add tlsInspectionPolicy once resource is ready
169164
resource "google_network_security_firewall_endpoint_association" "foobar" {
170-
provider = google-beta
171165
name = "tf-test-my-firewall-endpoint-association%{randomSuffix}"
172166
parent = "projects/%{billingProjectId}"
173167
location = "us-central1-a"

google/services/networksecurity/resource_network_security_firewall_endpoint_test.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func TestAccNetworkSecurityFirewallEndpoints_basic(t *testing.T) {
2626

2727
acctest.VcrTest(t, resource.TestCase{
2828
PreCheck: func() { acctest.AccTestPreCheck(t) },
29-
ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t),
29+
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
3030
CheckDestroy: testAccCheckNetworkSecurityFirewallEndpointDestroyProducer(t),
3131
Steps: []resource.TestStep{
3232
{
@@ -54,8 +54,6 @@ func TestAccNetworkSecurityFirewallEndpoints_basic(t *testing.T) {
5454
func testAccNetworkSecurityFirewallEndpoints_basic(orgId string, billingProjectId string, randomSuffix string) string {
5555
return fmt.Sprintf(`
5656
resource "google_network_security_firewall_endpoint" "foobar" {
57-
provider = google-beta
58-
5957
name = "tf-test-my-firewall-endpoint%[1]s"
6058
parent = "organizations/%[2]s"
6159
location = "us-central1-a"
@@ -71,8 +69,6 @@ resource "google_network_security_firewall_endpoint" "foobar" {
7169
func testAccNetworkSecurityFirewallEndpoints_update(orgId string, billingProjectId string, randomSuffix string) string {
7270
return fmt.Sprintf(`
7371
resource "google_network_security_firewall_endpoint" "foobar" {
74-
provider = google-beta
75-
7672
name = "tf-test-my-firewall-endpoint%[1]s"
7773
parent = "organizations/%[2]s"
7874
location = "us-central1-a"

google/services/networksecurity/resource_network_security_security_profile_group_test.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func TestAccNetworkSecuritySecurityProfileGroups_update(t *testing.T) {
1919

2020
acctest.VcrTest(t, resource.TestCase{
2121
PreCheck: func() { acctest.AccTestPreCheck(t) },
22-
ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t),
22+
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
2323
CheckDestroy: testAccCheckNetworkSecuritySecurityProfileGroupDestroyProducer(t),
2424
Steps: []resource.TestStep{
2525
{
@@ -47,15 +47,13 @@ func TestAccNetworkSecuritySecurityProfileGroups_update(t *testing.T) {
4747
func testAccNetworkSecuritySecurityProfileGroups_basic(orgId string, randomSuffix string) string {
4848
return fmt.Sprintf(`
4949
resource "google_network_security_security_profile" "foobar" {
50-
provider = google-beta
5150
name = "tf-test-my-security-profile%s"
5251
type = "THREAT_PREVENTION"
5352
parent = "organizations/%s"
5453
location = "global"
5554
}
5655
5756
resource "google_network_security_security_profile_group" "foobar" {
58-
provider = google-beta
5957
name = "tf-test-my-security-profile-group%s"
6058
parent = "organizations/%s"
6159
location = "global"
@@ -72,23 +70,20 @@ resource "google_network_security_security_profile_group" "foobar" {
7270
func testAccNetworkSecuritySecurityProfileGroups_update(orgId string, randomSuffix string) string {
7371
return fmt.Sprintf(`
7472
resource "google_network_security_security_profile" "foobar" {
75-
provider = google-beta
7673
name = "tf-test-my-security-profile%s"
7774
type = "THREAT_PREVENTION"
7875
parent = "organizations/%s"
7976
location = "global"
8077
}
8178
8279
resource "google_network_security_security_profile" "foobar_updated" {
83-
provider = google-beta
8480
name = "tf-test-my-security-profile-updated%s"
8581
type = "THREAT_PREVENTION"
8682
parent = "organizations/%s"
8783
location = "global"
8884
}
8985
9086
resource "google_network_security_security_profile_group" "foobar" {
91-
provider = google-beta
9287
name = "tf-test-my-security-profile-group%s"
9388
parent = "organizations/%s"
9489
location = "global"

google/services/networksecurity/resource_network_security_security_profile_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func TestAccNetworkSecuritySecurityProfiles_update(t *testing.T) {
1919

2020
acctest.VcrTest(t, resource.TestCase{
2121
PreCheck: func() { acctest.AccTestPreCheck(t) },
22-
ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t),
22+
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
2323
CheckDestroy: testAccCheckNetworkSecuritySecurityProfileDestroyProducer(t),
2424
Steps: []resource.TestStep{
2525
{
@@ -47,7 +47,6 @@ func TestAccNetworkSecuritySecurityProfiles_update(t *testing.T) {
4747
func testAccNetworkSecuritySecurityProfiles_basic(orgId string, randomSuffix string) string {
4848
return fmt.Sprintf(`
4949
resource "google_network_security_security_profile" "foobar" {
50-
provider = google-beta
5150
name = "tf-test-my-security-profile%s"
5251
parent = "organizations/%s"
5352
location = "global"
@@ -64,7 +63,6 @@ resource "google_network_security_security_profile" "foobar" {
6463
func testAccNetworkSecuritySecurityProfiles_update(orgId string, randomSuffix string) string {
6564
return fmt.Sprintf(`
6665
resource "google_network_security_security_profile" "foobar" {
67-
provider = google-beta
6866
name = "tf-test-my-security-profile%s"
6967
parent = "organizations/%s"
7068
location = "global"

google/services/networksecurity/resource_network_security_tls_inspection_policy_generated_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,13 @@ resource "google_privateca_certificate_authority" "default" {
117117
}
118118
}
119119
120-
resource "google_project_service_identity" "ns_sa" {
121-
service = "networksecurity.googleapis.com"
122-
}
120+
121+
data "google_project" "project" {}
123122
124123
resource "google_privateca_ca_pool_iam_member" "tls_inspection_permission" {
125124
ca_pool = google_privateca_ca_pool.default.id
126125
role = "roles/privateca.certificateManager"
127-
member = "serviceAccount:${google_project_service_identity.ns_sa.email}"
126+
member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-networksecurity.iam.gserviceaccount.com"
128127
}
129128
130129
resource "google_network_security_tls_inspection_policy" "default" {

google/services/networksecurity/resource_network_security_tls_inspection_policy_test.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,12 @@ resource "google_privateca_certificate_authority" "default" {
105105
}
106106
}
107107
108-
resource "google_project_service_identity" "ns_sa" {
109-
service = "networksecurity.googleapis.com"
110-
}
108+
data "google_project" "project" {}
111109
112110
resource "google_privateca_ca_pool_iam_member" "tls_inspection_permission" {
113111
ca_pool = google_privateca_ca_pool.default.id
114112
role = "roles/privateca.certificateManager"
115-
member = "serviceAccount:${google_project_service_identity.ns_sa.email}"
113+
member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-networksecurity.iam.gserviceaccount.com"
116114
}
117115
118116
resource "google_network_security_tls_inspection_policy" "foobar" {
@@ -187,14 +185,12 @@ resource "google_privateca_certificate_authority" "default" {
187185
}
188186
}
189187
190-
resource "google_project_service_identity" "ns_sa" {
191-
service = "networksecurity.googleapis.com"
192-
}
188+
data "google_project" "project" {}
193189
194190
resource "google_privateca_ca_pool_iam_member" "tls_inspection_permission" {
195191
ca_pool = google_privateca_ca_pool.default.id
196192
role = "roles/privateca.certificateManager"
197-
member = "serviceAccount:${google_project_service_identity.ns_sa.email}"
193+
member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-networksecurity.iam.gserviceaccount.com"
198194
}
199195
200196
resource "google_network_security_tls_inspection_policy" "foobar" {

website/docs/r/network_security_gateway_security_policy.html.markdown

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,18 +113,16 @@ resource "google_privateca_certificate_authority" "default" {
113113
}
114114
}
115115
116-
resource "google_project_service_identity" "ns_sa" {
116+
data "google_project" "project" {
117117
provider = google-beta
118-
119-
service = "networksecurity.googleapis.com"
120118
}
121119
122120
resource "google_privateca_ca_pool_iam_member" "tls_inspection_permission" {
123121
provider = google-beta
124122
125123
ca_pool = google_privateca_ca_pool.default.id
126124
role = "roles/privateca.certificateManager"
127-
member = "serviceAccount:${google_project_service_identity.ns_sa.email}"
125+
member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-networksecurity.iam.gserviceaccount.com"
128126
}
129127
130128
resource "google_network_security_tls_inspection_policy" "default" {

website/docs/r/network_security_tls_inspection_policy.html.markdown

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,13 @@ resource "google_privateca_certificate_authority" "default" {
9797
}
9898
}
9999
100-
resource "google_project_service_identity" "ns_sa" {
101-
service = "networksecurity.googleapis.com"
102-
}
100+
101+
data "google_project" "project" {}
103102
104103
resource "google_privateca_ca_pool_iam_member" "tls_inspection_permission" {
105104
ca_pool = google_privateca_ca_pool.default.id
106105
role = "roles/privateca.certificateManager"
107-
member = "serviceAccount:${google_project_service_identity.ns_sa.email}"
106+
member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-networksecurity.iam.gserviceaccount.com"
108107
}
109108
110109
resource "google_network_security_tls_inspection_policy" "default" {

0 commit comments

Comments
 (0)