Skip to content

Commit b3cd522

Browse files
authored
fix(infra): explicitly specify TF project ID (#392)
* fix(infra): explicitly specify TF project ID * chore: ignore lock file in examples
1 parent 9e559e7 commit b3cd522

File tree

5 files changed

+24
-41
lines changed

5 files changed

+24
-41
lines changed

docs/deployment/gcloud/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
*.backup
44
*.tfstate
55

6+
# Lock file not needed for examples.
7+
.terraform.lock.hcl
8+
69
# HCL vars except example
710
*.tfvars
811
!example.tfvars

docs/deployment/gcloud/.terraform.lock.hcl

Lines changed: 0 additions & 36 deletions
This file was deleted.

docs/deployment/gcloud/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
## Prerequisites
44

5-
* [OpenTofu](https://opentofu.org) or Terraform.
5+
* [Terraform](https://www.terraform.io/) or [OpenTofu](https://opentofu.org).
66
* [gcloud](https://cloud.google.com/sdk/docs/install) tool.
77
* [Google Cloud](https://cloud.google.com/) project.
88

99
## Setup
1010

11-
* Initialize project using `tofu init` command.
11+
* Initialize project using `terraform init` command.
1212
* Copy `example.tfvars` to `prod.tfvars` and edit the file.
1313
* Prepare Terraform plan using variables file: \
14-
`tofu plan -var-file="prod.tfvars" -out=tfplan`
15-
* Apply a plan using `tofu apply tfplan` command.
14+
`terraform plan -var-file="prod.tfvars" -out=tfplan`
15+
* Apply a plan using `terraform apply tfplan` command.

docs/deployment/gcloud/main.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# See: https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/cloud_run_v2_service
1+
# See: https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/cloud_run_v2_service
22

33
# Beta provider is required for "empty_dir" storage type.
44
provider "google-beta" {
@@ -109,6 +109,7 @@ resource "google_cloud_run_v2_service" "default" {
109109
# Make service public.
110110
# See: https://cloud.google.com/run/docs/authenticating/public
111111
resource "google_cloud_run_service_iam_binding" "run_invoker" {
112+
project = google_cloud_run_v2_service.default.project
112113
location = google_cloud_run_v2_service.default.location
113114
service = google_cloud_run_v2_service.default.name
114115
role = "roles/run.invoker"

docs/deployment/gcloud/versions.tf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
terraform {
2+
required_version = "~> 1.5"
3+
4+
required_providers {
5+
google-beta = {
6+
source = "hashicorp/google-beta"
7+
version = "~> 5.38"
8+
}
9+
10+
google = {
11+
source = "hashicorp/google"
12+
version = "~> 5.38"
13+
}
14+
}
15+
}

0 commit comments

Comments
 (0)