File tree Expand file tree Collapse file tree 12 files changed +264
-144
lines changed
asset-inventory-feed-remediation
scheduled-asset-inventory-export-bq
unmanaged-instances-healthcheck
networking/private-cloud-function-from-onprem
tests/modules/cloud_function_v2 Expand file tree Collapse file tree 12 files changed +264
-144
lines changed Original file line number Diff line number Diff line change @@ -79,19 +79,18 @@ module "cf" {
79
79
name = var. name
80
80
bucket_name = " ${ var . name } -${ random_pet . random . id } "
81
81
bucket_config = {
82
- location = var.region
83
- lifecycle_delete_age = null
82
+ location = var.region
84
83
}
85
84
bundle_config = {
86
85
source_dir = " cf"
87
86
output_path = var.bundle_path
88
- excludes = null
89
87
}
90
88
service_account = module. service-account . email
91
89
trigger_config = {
92
- event = " google.pubsub.topic.publish"
93
- resource = module.pubsub.topic.id
94
- retry = null
90
+ v1 = {
91
+ event = " google.pubsub.topic.publish"
92
+ resource = module.pubsub.topic.id
93
+ }
95
94
}
96
95
}
97
96
Original file line number Diff line number Diff line change @@ -137,23 +137,21 @@ module "cloud-function" {
137
137
name = " network-dashboard-cloud-function"
138
138
bucket_name = " ${ local . monitoring_project } -network-dashboard-bucket"
139
139
bucket_config = {
140
- location = var.region
141
- lifecycle_delete_age = null
140
+ location = var.region
142
141
}
143
142
region = var. region
144
143
145
144
bundle_config = {
146
145
source_dir = " cloud-function"
147
146
output_path = " cloud-function.zip"
148
- excludes = null
149
147
}
150
148
151
149
function_config = {
152
150
timeout = 480 # Timeout in seconds, increase it if your CF timeouts and use v2 if > 9 minutes.
153
151
entry_point = " main"
154
152
runtime = " python39"
155
153
instances = 1
156
- memory = 256 # Memory in MB
154
+ memory_mb = 256
157
155
158
156
}
159
157
@@ -169,10 +167,17 @@ module "cloud-function" {
169
167
# Internal only doesn't seem to work with CFv2:
170
168
ingress_settings = var. cf_version == " V2" ? " ALLOW_ALL" : " ALLOW_INTERNAL_ONLY"
171
169
172
- trigger_config = {
173
- event = " google.pubsub.topic.publish"
174
- resource = module.pubsub.topic.id
175
- retry = null
170
+ trigger_config = var. cf_version == " V2" ? {
171
+ v2 = {
172
+ event_type = " google.cloud.pubsub.topic.v1.messagePublished"
173
+ pubsub_topic = module.pubsub.topic.id
174
+ service_account_create = true
175
+ }
176
+ } : {
177
+ v1 = {
178
+ event = " google.pubsub.topic.publish"
179
+ resource = module.pubsub.topic.id
180
+ }
176
181
}
177
182
}
178
183
Original file line number Diff line number Diff line change @@ -52,13 +52,11 @@ module "cf" {
52
52
name = var. name
53
53
bucket_name = " ${ var . name } -${ random_pet . random . id } "
54
54
bucket_config = {
55
- location = var.region
56
- lifecycle_delete_age = null
55
+ location = var.region
57
56
}
58
57
bundle_config = {
59
58
source_dir = " cf"
60
59
output_path = var.bundle_path
61
- excludes = null
62
60
}
63
61
# https://github.com/hashicorp/terraform-provider-archive/issues/40
64
62
# https://issuetracker.google.com/issues/155215191
@@ -68,9 +66,10 @@ module "cf" {
68
66
}
69
67
service_account_create = true
70
68
trigger_config = {
71
- event = " google.pubsub.topic.publish"
72
- resource = module.pubsub.topic.id
73
- retry = null
69
+ v1 = {
70
+ event = " google.pubsub.topic.publish"
71
+ resource = module.pubsub.topic.id
72
+ }
74
73
}
75
74
}
76
75
Original file line number Diff line number Diff line change @@ -91,19 +91,18 @@ module "cf" {
91
91
name = var. name
92
92
bucket_name = " ${ var . name } -${ random_pet . random . id } "
93
93
bucket_config = {
94
- location = var.region
95
- lifecycle_delete_age = null
94
+ location = var.region
96
95
}
97
96
bundle_config = {
98
97
source_dir = " cf"
99
98
output_path = var.bundle_path
100
- excludes = null
101
99
}
102
100
service_account = module. service-account . email
103
101
trigger_config = {
104
- event = " google.pubsub.topic.publish"
105
- resource = module.pubsub.topic.id
106
- retry = null
102
+ v1 = {
103
+ event = " google.pubsub.topic.publish"
104
+ resource = module.pubsub.topic.id
105
+ }
107
106
}
108
107
}
109
108
@@ -115,8 +114,8 @@ module "cffile" {
115
114
name = var. name_cffile
116
115
bucket_name = " ${ var . name_cffile } -${ random_pet . random . id } "
117
116
bucket_config = {
118
- location = var.region
119
- lifecycle_delete_age = null
117
+ location = var.region
118
+ lifecycle_delete_age_days = null
120
119
}
121
120
bundle_config = {
122
121
source_dir = " cffile"
@@ -125,9 +124,11 @@ module "cffile" {
125
124
}
126
125
service_account = module. service-account . email
127
126
trigger_config = {
128
- event = " google.pubsub.topic.publish"
129
- resource = module.pubsub_file.topic.id
130
- retry = null
127
+ v1 = {
128
+ event = " google.pubsub.topic.publish"
129
+ resource = module.pubsub_file.topic.id
130
+ retry = null
131
+ }
131
132
}
132
133
}
133
134
Original file line number Diff line number Diff line change @@ -114,29 +114,28 @@ module "cf-restarter" {
114
114
region = var. region
115
115
bucket_name = " cf-bundle-bucket-${ random_pet . random . id } "
116
116
bucket_config = {
117
- location = var.region
118
- lifecycle_delete_age = null
117
+ location = var.region
119
118
}
120
119
bundle_config = {
121
120
source_dir = " ${ path . module } /function/restarter"
122
121
output_path = " restarter.zip"
123
- excludes = []
124
122
}
125
123
service_account = module. service-account-restarter . email
126
124
127
125
function_config = {
128
126
entry_point = " RestartInstance"
129
127
ingress_settings = null
130
- instances = 1
131
- memory = 256
128
+ instance_count = 1
129
+ memory_mb = 256
132
130
runtime = " go116"
133
131
timeout = 300
134
132
}
135
133
136
134
trigger_config = {
137
- event = " google.pubsub.topic.publish"
138
- resource = module.pubsub.topic.id
139
- retry = null
135
+ v1 = {
136
+ event = " google.pubsub.topic.publish"
137
+ resource = module.pubsub.topic.id
138
+ }
140
139
}
141
140
142
141
}
@@ -151,15 +150,14 @@ module "cf-healthchecker" {
151
150
bundle_config = {
152
151
source_dir = " ${ path . module } /function/healthchecker"
153
152
output_path = " healthchecker.zip"
154
- excludes = []
155
153
}
156
154
service_account = module. service-account-healthchecker . email
157
155
158
156
function_config = {
159
157
entry_point = " HealthCheck"
160
158
ingress_settings = null
161
- instances = 1
162
- memory = 256
159
+ instance_count = 1
160
+ memory_mb = 256
163
161
runtime = " go116"
164
162
timeout = 300
165
163
}
Original file line number Diff line number Diff line change @@ -195,11 +195,9 @@ module "function-hello" {
195
195
bundle_config = {
196
196
source_dir = " ${ path . module } /assets"
197
197
output_path = " bundle.zip"
198
- excludes = null
199
198
}
200
199
bucket_config = {
201
- location = var.region
202
- lifecycle_delete_age = null
200
+ location = var.region
203
201
}
204
202
iam = {
205
203
" roles/cloudfunctions.invoker" = [" allUsers" ]
Original file line number Diff line number Diff line change @@ -70,8 +70,8 @@ module "functions" {
70
70
region = each. value
71
71
ingress_settings = " ALLOW_ALL"
72
72
bucket_config = {
73
- location = null
74
- lifecycle_delete_age = 1
73
+ location = null
74
+ lifecycle_delete_age_days = 1
75
75
}
76
76
bundle_config = {
77
77
source_dir = " ${ path . module } /function"
You can’t perform that action at this time.
0 commit comments