Skip to content

Commit 369b98c

Browse files
Add Firebase Extensions Instance resource (#8133) (#15013)
* Add Firebase Extensions Instance resource * rename file from Extension to Instance * Change serviceAccountEmail to output * Make extensionRef trigger replacement Signed-off-by: Modular Magician <[email protected]>
1 parent 4d6c117 commit 369b98c

File tree

3 files changed

+291
-0
lines changed

3 files changed

+291
-0
lines changed

.changelog/8133.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:new-resource
2+
`google_firebase_extensions_instance`
3+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Copyright (c) HashiCorp, Inc.
2+
// SPDX-License-Identifier: MPL-2.0
3+
package google
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,285 @@
1+
---
2+
# ----------------------------------------------------------------------------
3+
#
4+
# *** AUTO GENERATED CODE *** Type: MMv1 ***
5+
#
6+
# ----------------------------------------------------------------------------
7+
#
8+
# This file is automatically generated by Magic Modules and manual
9+
# changes will be clobbered when the file is regenerated.
10+
#
11+
# Please read more about how to change this file in
12+
# .github/CONTRIBUTING.md.
13+
#
14+
# ----------------------------------------------------------------------------
15+
subcategory: "Firebase Extensions"
16+
description: |-
17+
An Instance is an installation of an Extension into a user's project.
18+
---
19+
20+
# google\_firebase\_extensions\_instance
21+
22+
An Instance is an installation of an Extension into a user's project.
23+
24+
~> **Warning:** This resource is in beta, and should be used with the terraform-provider-google-beta provider.
25+
See [Provider Versions](https://terraform.io/docs/providers/google/guides/provider_versions.html) for more details on beta resources.
26+
27+
To get more information about Instance, see:
28+
29+
* How-to Guides
30+
* [Official Documentation](https://firebase.google.com/products/extensions)
31+
32+
## Example Usage - Firebase Extentions Instance Resize Image
33+
34+
35+
```hcl
36+
resource "google_storage_bucket" "images" {
37+
provider = google-beta
38+
project = "my-project-name"
39+
name = "bucket-id"
40+
location = "US"
41+
uniform_bucket_level_access = true
42+
43+
# Delete all objects when the bucket is deleted
44+
force_destroy = true
45+
}
46+
47+
resource "google_firebase_extensions_instance" "resize_image" {
48+
provider = google-beta
49+
project = "my-project-name"
50+
instance_id = "storage-resize-images"
51+
config {
52+
extension_ref = "firebase/storage-resize-images"
53+
extension_version = "0.1.37"
54+
55+
# The following params apply to the firebase/storage-resize-images extension.
56+
# Different extensions may have different params
57+
params = {
58+
DELETE_ORIGINAL_FILE = false
59+
MAKE_PUBLIC = false
60+
IMAGE_TYPE = false
61+
IS_ANIMATED = true
62+
FUNCTION_MEMORY = 1024
63+
DO_BACKFILL = false
64+
IMG_SIZES = "200x200"
65+
IMG_BUCKET = google_storage_bucket.images.name
66+
LOCATION = ""
67+
}
68+
69+
system_params = {
70+
"firebaseextensions.v1beta.function/maxInstances" = 3000
71+
"firebaseextensions.v1beta.function/memory" = 256
72+
"firebaseextensions.v1beta.function/minInstances" = 0
73+
"firebaseextensions.v1beta.function/vpcConnectorEgressSettings" = "VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED"
74+
}
75+
76+
allowed_event_types = [
77+
"firebase.extensions.storage-resize-images.v1.complete"
78+
]
79+
80+
eventarc_channel = "projects/my-project-name/locations//channels/firebase"
81+
}
82+
}
83+
```
84+
85+
## Argument Reference
86+
87+
The following arguments are supported:
88+
89+
90+
* `config` -
91+
(Required)
92+
The current Config of the Extension Instance.
93+
Structure is [documented below](#nested_config).
94+
95+
* `instance_id` -
96+
(Required)
97+
The ID to use for the Extension Instance, which will become the final
98+
component of the instance's name.
99+
100+
101+
<a name="nested_config"></a>The `config` block supports:
102+
103+
* `name` -
104+
(Output)
105+
The unique identifier for this configuration.
106+
107+
* `create_time` -
108+
(Output)
109+
The time at which the Extension Instance Config was created.
110+
111+
* `params` -
112+
(Required)
113+
Environment variables that may be configured for the Extension
114+
115+
* `system_params` -
116+
(Optional)
117+
Params whose values are only available at deployment time.
118+
Unlike other params, these will not be set as environment variables on
119+
functions.
120+
121+
* `extension_ref` -
122+
(Required)
123+
The ref of the Extension from the Registry (e.g. publisher-id/awesome-extension)
124+
125+
* `extension_version` -
126+
(Optional)
127+
The version of the Extension from the Registry (e.g. 1.0.3). If left blank, latest is assumed.
128+
129+
* `allowed_event_types` -
130+
(Optional)
131+
List of extension events selected by consumer that extension is allowed to
132+
emit, identified by their types.
133+
134+
* `eventarc_channel` -
135+
(Optional)
136+
Fully qualified Eventarc resource name that consumers should use for event triggers.
137+
138+
* `populated_postinstall_content` -
139+
(Output)
140+
Postinstall instructions to be shown for this Extension, with
141+
template strings representing function and parameter values substituted
142+
with actual values. These strings include: ${param:FOO},
143+
${function:myFunc.url},
144+
${function:myFunc.name}, and ${function:myFunc.location}
145+
146+
- - -
147+
148+
149+
* `project` - (Optional) The ID of the project in which the resource belongs.
150+
If it is not provided, the provider project is used.
151+
152+
153+
## Attributes Reference
154+
155+
In addition to the arguments listed above, the following computed attributes are exported:
156+
157+
* `id` - an identifier for the resource with format `projects/{{project}}/instances/{{instance_id}}`
158+
159+
* `name` -
160+
The fully-qualified resource name of the Extension Instance.
161+
162+
* `create_time` -
163+
The time at which the Extension Instance was created.
164+
165+
* `update_time` -
166+
The time at which the Extension Instance was updated.
167+
168+
* `state` -
169+
The current state of the Extension Instance.
170+
DEPLOYING:
171+
The Extension Instance is waiting on an Operation to complete. Could
172+
resolve to `ACTIVE`, `PAUSED`, `ERRORED`.
173+
UNINSTALLING:
174+
The Extension Instance is being removed from the project. Could resolve
175+
to `ERRORED`, but more likely the instance will soon cease to exist.
176+
ACTIVE:
177+
The Extension Instance is installed and ready.
178+
ERRORED:
179+
The Extension Instance encountered an error while `DEPLOYING` or
180+
`UNINSTALLING`.
181+
PAUSED:
182+
The Extension's resources have been removed from the project, but the
183+
Config remains so the Instance can be restored.
184+
185+
* `error_status` -
186+
If this Instance has `state: ERRORED`, the error messages
187+
will be found here.
188+
Structure is [documented below](#nested_error_status).
189+
190+
* `service_account_email` -
191+
The email of the service account to be used at runtime by compute resources
192+
created for the operation of the Extension instance.
193+
194+
* `last_operation_name` -
195+
The name of the last operation that acted on this Extension
196+
Instance
197+
198+
* `last_operation_type` -
199+
The type of the last operation that acted on the Extension Instance.
200+
201+
* `etag` -
202+
A weak etag that is computed by the server based on other configuration
203+
values and may be sent on update and delete requests to ensure the
204+
client has an up-to-date value before proceeding.
205+
206+
* `runtime_data` -
207+
Data set by the extension instance at runtime.
208+
Structure is [documented below](#nested_runtime_data).
209+
210+
211+
<a name="nested_error_status"></a>The `error_status` block contains:
212+
213+
* `code` -
214+
(Optional)
215+
The status code, which should be an enum value of google.rpc.Code.
216+
217+
* `message` -
218+
(Optional)
219+
A developer-facing error message, which should be in English.
220+
221+
* `details` -
222+
(Optional)
223+
A list of messages that carry the error details.
224+
225+
<a name="nested_runtime_data"></a>The `runtime_data` block contains:
226+
227+
* `state_update_time` -
228+
(Optional)
229+
The time of the last state update.
230+
231+
* `processing_state` -
232+
(Optional)
233+
The processing state for the extension instance
234+
Structure is [documented below](#nested_processing_state).
235+
236+
* `fatal_error` -
237+
(Optional)
238+
The fatal error state for the extension instance
239+
Structure is [documented below](#nested_fatal_error).
240+
241+
242+
<a name="nested_processing_state"></a>The `processing_state` block supports:
243+
244+
* `state` -
245+
(Optional)
246+
The processing state of the extension instance.
247+
248+
* `detail_message` -
249+
(Optional)
250+
Details about the processing. e.g. This could include the type of
251+
processing in progress or it could list errors or failures.
252+
This information will be shown in the console on the detail page
253+
for the extension instance.
254+
255+
<a name="nested_fatal_error"></a>The `fatal_error` block supports:
256+
257+
* `error_message` -
258+
(Optional)
259+
The error message. This is set by the extension developer to give
260+
more detail on why the extension is unusable and must be re-installed
261+
or reconfigured.
262+
263+
## Timeouts
264+
265+
This resource provides the following
266+
[Timeouts](https://developer.hashicorp.com/terraform/plugin/sdkv2/resources/retries-and-customizable-timeouts) configuration options:
267+
268+
- `create` - Default is 20 minutes.
269+
- `update` - Default is 20 minutes.
270+
- `delete` - Default is 20 minutes.
271+
272+
## Import
273+
274+
275+
Instance can be imported using any of these accepted formats:
276+
277+
```
278+
$ terraform import google_firebase_extensions_instance.default projects/{{project}}/instances/{{instance_id}}
279+
$ terraform import google_firebase_extensions_instance.default {{project}}/{{instance_id}}
280+
$ terraform import google_firebase_extensions_instance.default {{instance_id}}
281+
```
282+
283+
## User Project Overrides
284+
285+
This resource supports [User Project Overrides](https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference#user_project_override).

0 commit comments

Comments
 (0)