Skip to content

Commit 3e9b7cf

Browse files
added server tls policy example configuration for mtls (#9104) (#16102)
[upstream:74f3808bbf499a1324c61835429993fd59cea515] Signed-off-by: Modular Magician <[email protected]>
1 parent b0631c1 commit 3e9b7cf

File tree

3 files changed

+73
-0
lines changed

3 files changed

+73
-0
lines changed

.changelog/9104.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:none
2+
google_network_security_server_tls_policy
3+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
-----BEGIN CERTIFICATE-----
2+
MIIDDzCCAfegAwIBAgIUDOiCLH9QNMMYnjPZVf4VwO9blsEwDQYJKoZIhvcNAQEL
3+
BQAwFjEUMBIGA1UEAwwLZXhhbXBsZS5jb20wIBcNMjIwODI0MDg0MDUxWhgPMzAy
4+
MTEyMjUwODQwNTFaMBYxFDASBgNVBAMMC2V4YW1wbGUuY29tMIIBIjANBgkqhkiG
5+
9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvOT925GG4lKV9HvAHsbecMhGPAqjhVRC26iZ
6+
UJC8oSWOu95lWJSX5ZhbiF6Nz192wDGV/VAh3Lxj8RYtcn75eDxQKTcKouDld+To
7+
CGIStPFWbR6rbysLuZqFVEXVOTvp2QIegInfrvnGC4j7Qpic7zrFB9HzJx+0HpeE
8+
yO4gkdzJfEK/gMmolUgJrKX59o+0+Rj+Jq3EtcQxL1fVBVJSx0NvpoR1eYpnHMr/
9+
rJKZkUUZ2xE86hrtpiP6OEYQTi00rmf4GnZF5QfGGD0xuoQXtR7Tu+XhKibXIhxc
10+
D4RzPLX1QS040PXvmMPLDb4YlUQ6V3Rs42JDvkkDwIMXZvn8awIDAQABo1MwUTAd
11+
BgNVHQ4EFgQURuo1CCZZAUv7xi02f2nC5tRbf18wHwYDVR0jBBgwFoAURuo1CCZZ
12+
AUv7xi02f2nC5tRbf18wDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOC
13+
AQEAqx3tDxurnYr9EUPhF5/LlDPYM+VI7EgrKdRnuIqUlZI0tm3vOGME0te6dBTC
14+
YLNaHLW3m/4Tm4M2eg0Kpz6CxJfn3109G31dCi0xwzSDHf5TPUWvqIVhq5WRgMIf
15+
n8KYBlQSmqdJBRztUIQH/UPFnSbxymlS4s5qwDgTH5ag9EEBcnWsQ2LZjKi0eqve
16+
MaqAvvB+j8RGZzYY4re94bSJI42zIZ6nMWPtXwRuDc30xl/u+E0jWIgWbPwSd6Km
17+
3wnJnGiU2ezPGq3zEU+Rc39VVIFKQpciNeYuF3neHPJvYOf58qW2Z8s0VH0MR1x3
18+
3DoO/e30FIr9j+PRD+s5BPKF2A==
19+
-----END CERTIFICATE-----

website/docs/r/network_security_server_tls_policy.html.markdown

+51
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,57 @@ resource "google_network_security_server_tls_policy" "default" {
117117
}
118118
}
119119
```
120+
<div class = "oics-button" style="float: right; margin: 0 0 -15px">
121+
<a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.jpy.wang%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_working_dir=network_security_server_tls_policy_mtls&cloudshell_image=gcr.io%2Fcloudshell-images%2Fcloudshell%3Alatest&open_in_editor=main.tf&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md" target="_blank">
122+
<img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;">
123+
</a>
124+
</div>
125+
## Example Usage - Network Security Server Tls Policy Mtls
126+
127+
128+
```hcl
129+
data "google_project" "project" {
130+
provider = google-beta
131+
}
132+
133+
resource "google_network_security_server_tls_policy" "default" {
134+
provider = google-beta
135+
name = "my-server-tls-policy"
136+
137+
description = "my description"
138+
location = "global"
139+
allow_open = "false"
140+
141+
mtls_policy {
142+
client_validation_mode = "REJECT_INVALID"
143+
client_validation_trust_config = "projects/${data.google_project.project.number}/locations/global/trustConfigs/${google_certificate_manager_trust_config.default.name}"
144+
}
145+
146+
labels = {
147+
foo = "bar"
148+
}
149+
}
150+
151+
resource "google_certificate_manager_trust_config" "default" {
152+
provider = google-beta
153+
name = "my-trust-config"
154+
description = "sample trust config description"
155+
location = "global"
156+
157+
trust_stores {
158+
trust_anchors {
159+
pem_certificate = file("test-fixtures/ca_cert.pem")
160+
}
161+
intermediate_cas {
162+
pem_certificate = file("test-fixtures/ca_cert.pem")
163+
}
164+
}
165+
166+
labels = {
167+
foo = "bar"
168+
}
169+
}
170+
```
120171

121172
## Argument Reference
122173

0 commit comments

Comments
 (0)