-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Copy pathterraform.yaml
246 lines (243 loc) · 12.5 KB
/
terraform.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
# Copyright 2019 Google Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
--- !ruby/object:Provider::Terraform::Config
overrides: !ruby/object:Overrides::ResourceOverrides
DomainMapping: !ruby/object:Overrides::Terraform::ResourceOverride
id_format: "locations/{{location}}/namespaces/{{project}}/domainmappings/{{name}}"
import_format: ["locations/{{location}}/namespaces/{{project}}/domainmappings/{{name}}"]
error_retry_predicates: ["isCloudRunCreationConflict"]
async: !ruby/object:Provider::Terraform::PollAsync
check_response_func_existence: PollCheckKnativeStatusFunc(res)
actions: ['create', 'update']
examples:
- !ruby/object:Provider::Terraform::Examples
name: "cloud_run_domain_mapping_basic"
primary_resource_id: "default"
vars:
cloud_run_service_name: "cloudrun-srv"
test_env_vars:
namespace: :PROJECT_NAME
custom_code: !ruby/object:Provider::Terraform::CustomCode
encoder: 'templates/terraform/encoders/cloud_run_domain_mapping.go.erb'
decoder: 'templates/terraform/decoders/cloud_run.go.erb'
constants: templates/terraform/constants/cloud_run_domain_mapping.go.erb
properties:
name: !ruby/object:Overrides::Terraform::PropertyOverride
required: true
exclude: false
# excluding kind from Terraform code because this is a static, hardcoded value
kind: !ruby/object:Overrides::Terraform::PropertyOverride
exclude: true
apiVersion: !ruby/object:Overrides::Terraform::PropertyOverride
exclude: true
metadata.labels: !ruby/object:Overrides::Terraform::PropertyOverride
default_from_api: true
diff_suppress_func: 'domainMappingLabelDiffSuppress'
metadata.annotations: !ruby/object:Overrides::Terraform::PropertyOverride
default_from_api: true
diff_suppress_func: 'cloudrunAnnotationDiffSuppress'
metadata.namespace: !ruby/object:Overrides::Terraform::PropertyOverride
custom_flatten: templates/terraform/custom_flatten/set_to_project.go.erb
metadata.name: !ruby/object:Overrides::Terraform::PropertyOverride
exclude: true
spec.routeName: !ruby/object:Overrides::Terraform::PropertyOverride
custom_expand: 'templates/terraform/custom_expand/resource_from_self_link.go.erb'
diff_suppress_func: 'compareSelfLinkOrResourceName'
spec.forceOverride: !ruby/object:Overrides::Terraform::PropertyOverride
custom_flatten: templates/terraform/custom_flatten/cloudrun_ignore_force_override.go.erb
Service: !ruby/object:Overrides::Terraform::ResourceOverride
docs: !ruby/object:Provider::Terraform::Docs
warning: |
`google_cloudrun_service` creates a Managed Google Cloud Run Service. If you need to create
a Cloud Run Service on Anthos(GKE/VMWare) then you will need to create it using the kubernetes alpha provider.
Have a look at the Cloud Run Anthos example below.
id_format: "locations/{{location}}/namespaces/{{project}}/services/{{name}}"
import_format: ["locations/{{location}}/namespaces/{{project}}/services/{{name}}"]
error_retry_predicates: ["isCloudRunCreationConflict"]
async: !ruby/object:Provider::Terraform::PollAsync
check_response_func_existence: PollCheckKnativeStatusFunc(res)
actions: ['create', 'update']
examples:
- !ruby/object:Provider::Terraform::Examples
name: "cloud_run_service_basic"
primary_resource_id: "default"
primary_resource_name: "fmt.Sprintf(\"tf-test-cloudrun-srv%s\", context[\"random_suffix\"])"
vars:
cloud_run_service_name: "cloudrun-srv"
test_env_vars:
project: :PROJECT_NAME
- !ruby/object:Provider::Terraform::Examples
name: "cloud_run_service_sql"
primary_resource_id: "default"
primary_resource_name: "fmt.Sprintf(\"tf-test-cloudrun-srv%s\", context[\"random_suffix\"])"
vars:
cloud_run_service_name: "cloudrun-srv"
cloud_run_sql_name: "cloudrun-sql"
deletion_protection: "true"
test_vars_overrides:
deletion_protection: "false"
oics_vars_overrides:
deletion_protection: "false"
ignore_read_extra:
- "autogenerate_revision_name"
- !ruby/object:Provider::Terraform::Examples
name: "cloud_run_service_noauth"
primary_resource_id: "default"
primary_resource_name: "fmt.Sprintf(\"tf-test-cloudrun-srv%s\", context[\"random_suffix\"])"
vars:
cloud_run_service_name: "cloudrun-srv"
test_env_vars:
project: :PROJECT_NAME
- !ruby/object:Provider::Terraform::Examples
name: "cloud_run_anthos"
skip_test: true
- !ruby/object:Provider::Terraform::Examples
name: "cloud_run_service_multiple_environment_variables"
primary_resource_id: "default"
primary_resource_name: "fmt.Sprintf(\"tf-test-cloudrun-srv%s\", context[\"random_suffix\"])"
vars:
cloud_run_service_name: "cloudrun-srv"
test_env_vars:
project: :PROJECT_NAME
ignore_read_extra:
- "autogenerate_revision_name"
- !ruby/object:Provider::Terraform::Examples
name: "cloud_run_service_traffic_split"
skip_test: true
primary_resource_id: "default"
primary_resource_name: "fmt.Sprintf(\"tf-test-cloudrun-srv%s\", context[\"random_suffix\"])"
vars:
cloud_run_service_name: "cloudrun-srv"
test_env_vars:
project: :PROJECT_NAME
- !ruby/object:Provider::Terraform::Examples
name: "cloud_run_service_secret_environment_variables"
primary_resource_id: "default"
primary_resource_name: "fmt.Sprintf(\"tf-test-cloudrun-srv%s\", context[\"random_suffix\"])"
vars:
cloud_run_service_name: "cloudrun-srv"
secret_id: "secret"
test_env_vars:
project: :PROJECT_NAME
ignore_read_extra:
- "autogenerate_revision_name"
- !ruby/object:Provider::Terraform::Examples
name: "cloud_run_service_secret_volumes"
primary_resource_id: "default"
primary_resource_name: "fmt.Sprintf(\"tf-test-cloudrun-srv%s\", context[\"random_suffix\"])"
vars:
cloud_run_service_name: "cloudrun-srv"
secret_id: "secret"
test_env_vars:
project: :PROJECT_NAME
ignore_read_extra:
- "autogenerate_revision_name"
- !ruby/object:Provider::Terraform::Examples
name: "eventarc_basic_tf"
primary_resource_id: "default"
vars:
cloudrun_hello_tf: "cloudrun-hello-tf"
trigger_pubsub_tf: "trigger-pubsub-tf"
trigger_auditlog_tf: "trigger-auditlog-tf"
min_version: beta
virtual_fields:
- !ruby/object:Api::Type::Boolean
name: 'autogenerate_revision_name'
default_value: false
description: |
If set to `true`, the revision name (template.metadata.name) will be omitted and
autogenerated by Cloud Run. This cannot be set to `true` while `template.metadata.name`
is also set.
(For legacy support, if `template.metadata.name` is unset in state while
this field is set to false, the revision name will still autogenerate.)
custom_code: !ruby/object:Provider::Terraform::CustomCode
encoder: 'templates/terraform/encoders/cloud_run_service.go.erb'
decoder: 'templates/terraform/decoders/cloud_run.go.erb'
constants: templates/terraform/constants/cloud_run_service.go.erb
resource_definition: templates/terraform/resource_definition/cloud_run_service.go.erb
properties:
name: !ruby/object:Overrides::Terraform::PropertyOverride
required: true
exclude: false
# excluding kind from Terraform code because it only accepts the same single value
# so we hard code it in the encoder instead.
kind: !ruby/object:Overrides::Terraform::PropertyOverride
exclude: true
apiVersion: !ruby/object:Overrides::Terraform::PropertyOverride
exclude: true
spec: !ruby/object:Overrides::Terraform::PropertyOverride
flatten_object: true
spec.template.metadata: !ruby/object:Overrides::Terraform::PropertyOverride
default_from_api: true
spec.template.metadata.name: !ruby/object:Overrides::Terraform::PropertyOverride
custom_expand: 'templates/terraform/custom_expand/cloud_run_service_revision_name.erb'
default_from_api: true
spec.template.metadata.annotations: !ruby/object:Overrides::Terraform::PropertyOverride
default_from_api: true
diff_suppress_func: 'cloudrunTemplateAnnotationDiffSuppress'
spec.template.metadata.namespace: !ruby/object:Overrides::Terraform::PropertyOverride
default_from_api: true
custom_expand: "templates/terraform/custom_expand/default_to_project.go.erb"
spec.template.spec: !ruby/object:Overrides::Terraform::PropertyOverride
default_from_api: true
spec.template.spec.containerConcurrency: !ruby/object:Overrides::Terraform::PropertyOverride
default_from_api: true
spec.template.spec.timeoutSeconds: !ruby/object:Overrides::Terraform::PropertyOverride
default_from_api: true
spec.template.spec.serviceAccountName: !ruby/object:Overrides::Terraform::PropertyOverride
default_from_api: true
spec.template.spec.containers: !ruby/object:Overrides::Terraform::PropertyOverride
default_from_api: true
spec.template.spec.containers.ports: !ruby/object:Overrides::Terraform::PropertyOverride
default_from_api: true
spec.template.spec.containers.ports.name: !ruby/object:Overrides::Terraform::PropertyOverride
default_from_api: true
spec.template.spec.containers.env: !ruby/object:Overrides::Terraform::PropertyOverride
is_set: true
spec.template.spec.containers.resources: !ruby/object:Overrides::Terraform::PropertyOverride
default_from_api: true
spec.template.spec.containers.resources.limits: !ruby/object:Overrides::Terraform::PropertyOverride
default_from_api: true
# Terraform autofills the only required field in metadata
metadata: !ruby/object:Overrides::Terraform::PropertyOverride
default_from_api: true
required: false
metadata.namespace: !ruby/object:Overrides::Terraform::PropertyOverride
# marking namepsace as optional so that 1) it can be inferred from the provider
# project and 2) so customizeDiff can clear the diff when projectNumber == projectName
required: false
default_from_api: true
# Namespace takes a projectNumber or projectId but will always return the projectNumber
# rather than make a second API query to allow for canonical comparison we are assuming
# that this field is "correct" as a Service should never migrate between projects out
# of band of Terraform. This assumes namespace will always be a project.
custom_flatten: templates/terraform/custom_flatten/set_to_project.go.erb
custom_expand: "templates/terraform/custom_expand/default_to_project.go.erb"
metadata.labels: !ruby/object:Overrides::Terraform::PropertyOverride
default_from_api: true
diff_suppress_func: 'cloudrunLabelDiffSuppress'
metadata.annotations: !ruby/object:Overrides::Terraform::PropertyOverride
default_from_api: true
diff_suppress_func: 'cloudrunAnnotationDiffSuppress'
spec.traffic: !ruby/object:Overrides::Terraform::PropertyOverride
default_from_api: true
# name is 'special' in magic modules and lives at the root of properties.
# We are using encoders to set name at the root here.
metadata.name: !ruby/object:Overrides::Terraform::PropertyOverride
exclude: true
# This is for copying files over
files: !ruby/object:Provider::Config::Files
# These files have templating (ERB) code that will be run.
# This is usually to add licensing info, autogeneration notices, etc.
compile:
<%= lines(indent(compile('provider/terraform/product~compile.yaml'), 4)) -%>