Skip to content

Commit 5ff3fde

Browse files
committed
feat(networksecurity): Add samples for intercept firewall rule creation
1 parent efce91d commit 5ff3fde

File tree

1 file changed

+17
-7
lines changed
  • network_security/intercept/basic/consumer

1 file changed

+17
-7
lines changed

network_security/intercept/basic/consumer/main.tf

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,21 @@
1414
* limitations under the License.
1515
*/
1616

17+
# Using a custom project for org-level resource testing.
18+
provider "google-beta" {
19+
project = "tppi-external-testing"
20+
user_project_override = true
21+
}
22+
23+
data "google_project" "default" {
24+
provider = google-beta
25+
}
26+
27+
data "google_organization" "default" {
28+
provider = google-beta
29+
organization = data.google_project.default.org_id
30+
}
31+
1732
# [START networksecurity_intercept_basic_consumer]
1833
# [START networksecurity_intercept_create_producer_network_tf]
1934
resource "google_compute_network" "producer_network" {
@@ -69,12 +84,6 @@ resource "google_network_security_intercept_endpoint_group_association" "default
6984
}
7085
# [END networksecurity_intercept_create_endpoint_group_association_tf]
7186

72-
data "google_project" "default" {}
73-
74-
data "google_organization" "default" {
75-
organization = data.google_project.default.org_id
76-
}
77-
7887
# [START networksecurity_intercept_create_security_profile_tf]
7988
resource "google_network_security_security_profile" "default" {
8089
provider = google-beta
@@ -113,7 +122,7 @@ resource "google_compute_network_firewall_policy_rule" "default" {
113122
priority = 1000
114123
action = "apply_security_profile_group"
115124
direction = "INGRESS"
116-
security_profile_group = "//networksecurity.googleapis.com/${google_network_security_security_profile_group.default.id}"
125+
security_profile_group = google_network_security_security_profile_group.default.id
117126

118127
match {
119128
layer4_configs {
@@ -127,6 +136,7 @@ resource "google_compute_network_firewall_policy_rule" "default" {
127136

128137
# [START networksecurity_intercept_create_firewall_policy_association_tf]
129138
resource "google_compute_network_firewall_policy_association" "default" {
139+
provider = google-beta
130140
name = "firewall-policy-assoc"
131141
attachment_target = google_compute_network.consumer_network.id
132142
firewall_policy = google_compute_network_firewall_policy.default.name

0 commit comments

Comments
 (0)