forked from GoogleCloudPlatform/magic-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert example templates (part 5) (GoogleCloudPlatform#10398)
- Loading branch information
1 parent
78debdc
commit 402af7f
Showing
214 changed files
with
7,073 additions
and
0 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
mmv1/templates/terraform/examples/go/scan_config_basic.tf.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
resource "google_compute_address" "scanner_static_ip" { | ||
provider = google-beta | ||
name = "{{index $.Vars "address_name"}}" | ||
} | ||
|
||
resource "google_security_scanner_scan_config" "{{$.PrimaryResourceId}}" { | ||
provider = google-beta | ||
display_name = "{{index $.Vars "scan_config_name"}}" | ||
starting_urls = ["http://${google_compute_address.scanner_static_ip.address}"] | ||
target_platforms = ["COMPUTE"] | ||
} |
18 changes: 18 additions & 0 deletions
18
mmv1/templates/terraform/examples/go/scc_event_threat_detection_custom_module.tf.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
resource "google_scc_event_threat_detection_custom_module" "{{$.PrimaryResourceId}}" { | ||
organization = "{{index $.TestEnvVars "org_id"}}" | ||
display_name = "{{index $.Vars "display_name"}}" | ||
enablement_state = "ENABLED" | ||
type = "{{index $.Vars "type"}}" | ||
description = "My Event Threat Detection Custom Module" | ||
config = jsonencode({ | ||
"metadata": { | ||
"severity": "LOW", | ||
"description": "Flagged by Forcepoint as malicious", | ||
"recommendation": "Contact the owner of the relevant project." | ||
}, | ||
"ips": [ | ||
"192.0.2.1", | ||
"192.0.2.0/24" | ||
] | ||
}) | ||
} |
23 changes: 23 additions & 0 deletions
23
mmv1/templates/terraform/examples/go/scc_folder_custom_module_basic.tf.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
resource "google_folder" "folder" { | ||
parent = "organizations/{{index $.TestEnvVars "org_id"}}" | ||
display_name = "{{index $.Vars "folder_display_name"}}" | ||
} | ||
|
||
resource "google_scc_folder_custom_module" "{{$.PrimaryResourceId}}" { | ||
folder = google_folder.folder.folder_id | ||
display_name = "{{index $.Vars "display_name"}}" | ||
enablement_state = "ENABLED" | ||
custom_config { | ||
predicate { | ||
expression = "resource.rotationPeriod > duration(\"2592000s\")" | ||
} | ||
resource_selector { | ||
resource_types = [ | ||
"cloudkms.googleapis.com/CryptoKey", | ||
] | ||
} | ||
description = "The rotation period of the identified cryptokey resource exceeds 30 days." | ||
recommendation = "Set the rotation period to at most 30 days." | ||
severity = "MEDIUM" | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
mmv1/templates/terraform/examples/go/scc_folder_custom_module_full.tf.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
resource "google_folder" "folder" { | ||
parent = "organizations/{{index $.TestEnvVars "org_id"}}" | ||
display_name = "{{index $.Vars "folder_display_name"}}" | ||
} | ||
|
||
resource "google_scc_folder_custom_module" "{{$.PrimaryResourceId}}" { | ||
folder = google_folder.folder.folder_id | ||
display_name = "{{index $.Vars "display_name"}}" | ||
enablement_state = "ENABLED" | ||
custom_config { | ||
predicate { | ||
expression = "resource.rotationPeriod > duration(\"2592000s\")" | ||
title = "Purpose of the expression" | ||
description = "description of the expression" | ||
location = "location of the expression" | ||
} | ||
custom_output { | ||
properties { | ||
name = "duration" | ||
value_expression { | ||
expression = "resource.rotationPeriod" | ||
title = "Purpose of the expression" | ||
description = "description of the expression" | ||
location = "location of the expression" | ||
} | ||
} | ||
} | ||
resource_selector { | ||
resource_types = [ | ||
"cloudkms.googleapis.com/CryptoKey", | ||
] | ||
} | ||
severity = "LOW" | ||
description = "Description of the custom module" | ||
recommendation = "Steps to resolve violation" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
resource "google_scc_mute_config" "{{$.PrimaryResourceId}}" { | ||
mute_config_id = "{{index $.Vars "mute_config_id"}}" | ||
parent = "organizations/{{index $.TestEnvVars "org_id"}}" | ||
filter = "category: \"OS_VULNERABILITY\"" | ||
description = "My Mute Config" | ||
} |
14 changes: 14 additions & 0 deletions
14
mmv1/templates/terraform/examples/go/scc_notification_config_basic.tf.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
resource "google_pubsub_topic" "scc_notification" { | ||
name = "{{index $.Vars "topic_name"}}" | ||
} | ||
|
||
resource "google_scc_notification_config" "{{$.PrimaryResourceId}}" { | ||
config_id = "{{index $.Vars "config_id"}}" | ||
organization = "{{index $.TestEnvVars "org_id"}}" | ||
description = "My custom Cloud Security Command Center Finding Notification Configuration" | ||
pubsub_topic = google_pubsub_topic.scc_notification.id | ||
|
||
streaming_config { | ||
filter = "category = \"OPEN_FIREWALL\" AND state = \"ACTIVE\"" | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
mmv1/templates/terraform/examples/go/scc_organization_custom_module_basic.tf.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
resource "google_scc_organization_custom_module" "{{$.PrimaryResourceId}}" { | ||
organization = "{{index $.TestEnvVars "org_id"}}" | ||
display_name = "{{index $.Vars "display_name"}}" | ||
enablement_state = "ENABLED" | ||
custom_config { | ||
predicate { | ||
expression = "resource.rotationPeriod > duration(\"2592000s\")" | ||
} | ||
resource_selector { | ||
resource_types = [ | ||
"cloudkms.googleapis.com/CryptoKey", | ||
] | ||
} | ||
description = "The rotation period of the identified cryptokey resource exceeds 30 days." | ||
recommendation = "Set the rotation period to at most 30 days." | ||
severity = "MEDIUM" | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
mmv1/templates/terraform/examples/go/scc_organization_custom_module_full.tf.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
resource "google_scc_organization_custom_module" "{{$.PrimaryResourceId}}" { | ||
organization = "{{index $.TestEnvVars "org_id"}}" | ||
display_name = "{{index $.Vars "display_name"}}" | ||
enablement_state = "ENABLED" | ||
custom_config { | ||
predicate { | ||
expression = "resource.rotationPeriod > duration(\"2592000s\")" | ||
title = "Purpose of the expression" | ||
description = "description of the expression" | ||
location = "location of the expression" | ||
} | ||
custom_output { | ||
properties { | ||
name = "duration" | ||
value_expression { | ||
expression = "resource.rotationPeriod" | ||
title = "Purpose of the expression" | ||
description = "description of the expression" | ||
location = "location of the expression" | ||
} | ||
} | ||
} | ||
resource_selector { | ||
resource_types = [ | ||
"cloudkms.googleapis.com/CryptoKey", | ||
] | ||
} | ||
severity = "LOW" | ||
description = "Description of the custom module" | ||
recommendation = "Steps to resolve violation" | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
mmv1/templates/terraform/examples/go/scc_project_custom_module_basic.tf.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
resource "google_scc_project_custom_module" "{{$.PrimaryResourceId}}" { | ||
display_name = "{{index $.Vars "display_name"}}" | ||
enablement_state = "ENABLED" | ||
custom_config { | ||
predicate { | ||
expression = "resource.rotationPeriod > duration(\"2592000s\")" | ||
} | ||
resource_selector { | ||
resource_types = [ | ||
"cloudkms.googleapis.com/CryptoKey", | ||
] | ||
} | ||
description = "The rotation period of the identified cryptokey resource exceeds 30 days." | ||
recommendation = "Set the rotation period to at most 30 days." | ||
severity = "MEDIUM" | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
mmv1/templates/terraform/examples/go/scc_project_custom_module_full.tf.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
resource "google_scc_project_custom_module" "{{$.PrimaryResourceId}}" { | ||
display_name = "{{index $.Vars "display_name"}}" | ||
enablement_state = "ENABLED" | ||
custom_config { | ||
predicate { | ||
expression = "resource.rotationPeriod > duration(\"2592000s\")" | ||
title = "Purpose of the expression" | ||
description = "description of the expression" | ||
location = "location of the expression" | ||
} | ||
custom_output { | ||
properties { | ||
name = "duration" | ||
value_expression { | ||
expression = "resource.rotationPeriod" | ||
title = "Purpose of the expression" | ||
description = "description of the expression" | ||
location = "location of the expression" | ||
} | ||
} | ||
} | ||
resource_selector { | ||
resource_types = [ | ||
"cloudkms.googleapis.com/CryptoKey", | ||
] | ||
} | ||
severity = "LOW" | ||
description = "Description of the custom module" | ||
recommendation = "Steps to resolve violation" | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
mmv1/templates/terraform/examples/go/scc_source_basic.tf.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
resource "google_scc_source" "{{$.PrimaryResourceId}}" { | ||
display_name = "{{index $.Vars "source_display_name"}}" | ||
organization = "{{index $.TestEnvVars "org_id"}}" | ||
description = "My custom Cloud Security Command Center Finding Source" | ||
} |
26 changes: 26 additions & 0 deletions
26
mmv1/templates/terraform/examples/go/scheduler_job_app_engine.tf.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
resource "google_cloud_scheduler_job" "job" { | ||
name = "{{index $.Vars "job_name"}}" | ||
schedule = "*/4 * * * *" | ||
description = "test app engine job" | ||
time_zone = "Europe/London" | ||
attempt_deadline = "320s" | ||
|
||
retry_config { | ||
min_backoff_duration = "1s" | ||
max_retry_duration = "10s" | ||
max_doublings = 2 | ||
retry_count = 3 | ||
} | ||
|
||
app_engine_http_target { | ||
http_method = "POST" | ||
|
||
app_engine_routing { | ||
service = "web" | ||
version = "prod" | ||
instance = "my-instance-001" | ||
} | ||
|
||
relative_uri = "/ping" | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
mmv1/templates/terraform/examples/go/scheduler_job_http.tf.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
resource "google_cloud_scheduler_job" "job" { | ||
name = "{{index $.Vars "job_name"}}" | ||
description = "test http job" | ||
schedule = "*/8 * * * *" | ||
time_zone = "America/New_York" | ||
attempt_deadline = "320s" | ||
|
||
retry_config { | ||
retry_count = 1 | ||
} | ||
|
||
http_target { | ||
http_method = "POST" | ||
uri = "https://example.com/" | ||
body = base64encode("{\"foo\":\"bar\"}") | ||
headers = { | ||
"Content-Type" = "application/json" | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
mmv1/templates/terraform/examples/go/scheduler_job_oauth.tf.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
data "google_compute_default_service_account" "default" { | ||
} | ||
|
||
resource "google_cloud_scheduler_job" "job" { | ||
name = "{{index $.Vars "job_name"}}" | ||
description = "test http job" | ||
schedule = "*/8 * * * *" | ||
time_zone = "America/New_York" | ||
attempt_deadline = "320s" | ||
|
||
http_target { | ||
http_method = "GET" | ||
uri = "https://cloudscheduler.googleapis.com/v1/projects/{{index $.TestEnvVars "project_name"}}/locations/{{index $.TestEnvVars "region"}}/jobs" | ||
|
||
oauth_token { | ||
service_account_email = data.google_compute_default_service_account.default.email | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
mmv1/templates/terraform/examples/go/scheduler_job_oidc.tf.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
data "google_compute_default_service_account" "default" { | ||
} | ||
|
||
resource "google_cloud_scheduler_job" "job" { | ||
name = "{{index $.Vars "job_name"}}" | ||
description = "test http job" | ||
schedule = "*/8 * * * *" | ||
time_zone = "America/New_York" | ||
attempt_deadline = "320s" | ||
|
||
http_target { | ||
http_method = "GET" | ||
uri = "https://example.com/ping" | ||
|
||
oidc_token { | ||
service_account_email = data.google_compute_default_service_account.default.email | ||
} | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
mmv1/templates/terraform/examples/go/scheduler_job_paused.tf.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
resource "google_cloud_scheduler_job" "job" { | ||
paused = true | ||
name = "{{index $.Vars "job_name"}}" | ||
description = "test http job with updated fields" | ||
schedule = "*/8 * * * *" | ||
time_zone = "America/New_York" | ||
attempt_deadline = "320s" | ||
|
||
retry_config { | ||
retry_count = 1 | ||
} | ||
|
||
http_target { | ||
http_method = "POST" | ||
uri = "https://example.com/ping" | ||
body = base64encode("{\"foo\":\"bar\"}") | ||
headers = { | ||
"Content-Type" = "application/json" | ||
} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
mmv1/templates/terraform/examples/go/scheduler_job_pubsub.tf.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
resource "google_pubsub_topic" "topic" { | ||
name = "{{index $.Vars "topic_name"}}" | ||
} | ||
|
||
resource "google_cloud_scheduler_job" "job" { | ||
name = "{{index $.Vars "job_name"}}" | ||
description = "test job" | ||
schedule = "*/2 * * * *" | ||
|
||
pubsub_target { | ||
# topic.id is the topic's full resource name. | ||
topic_name = google_pubsub_topic.topic.id | ||
data = base64encode("test") | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
mmv1/templates/terraform/examples/go/secret_config_basic.tf.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
resource "google_secret_manager_secret" "{{$.PrimaryResourceId}}" { | ||
secret_id = "{{index $.Vars "secret_id"}}" | ||
|
||
labels = { | ||
label = "my-label" | ||
} | ||
|
||
replication { | ||
user_managed { | ||
replicas { | ||
location = "us-central1" | ||
} | ||
replicas { | ||
location = "us-east1" | ||
} | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
mmv1/templates/terraform/examples/go/secret_version_basic.tf.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
resource "google_secret_manager_secret" "secret-basic" { | ||
secret_id = "{{index $.Vars "secret_id"}}" | ||
|
||
labels = { | ||
label = "my-label" | ||
} | ||
|
||
replication { | ||
auto {} | ||
} | ||
} | ||
|
||
|
||
resource "google_secret_manager_secret_version" "{{$.PrimaryResourceId}}" { | ||
secret = google_secret_manager_secret.secret-basic.id | ||
|
||
secret_data = "{{index $.Vars "data"}}" | ||
} |
Oops, something went wrong.