Skip to content

Commit

Permalink
Increase stability of opentofu scripts by using PATCH-like function…
Browse files Browse the repository at this point in the history
…s instead of `PUT`-like functions
  • Loading branch information
SteveMicroNova committed Nov 6, 2024
1 parent 33cde01 commit d1a6776
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
24 changes: 8 additions & 16 deletions opentofu/api.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,36 +27,28 @@ resource "google_project_iam_custom_role" "api_compute" {
]
}

resource "google_project_iam_binding" "api_compute" {
resource "google_project_iam_member" "api_compute" {
project = data.google_project.project.project_id
role = google_project_iam_custom_role.api_compute.name
members = [
"serviceAccount:${google_service_account.api.email}"
]
member = "serviceAccount:${google_service_account.api.email}"
}

resource "google_project_iam_binding" "api_sql_instance_user" {
resource "google_project_iam_member" "api_sql_instance_user" {
project = data.google_project.project.project_id
role = "roles/cloudsql.instanceUser"
members = [
"serviceAccount:${google_service_account.api.email}"
]
member = "serviceAccount:${google_service_account.api.email}"
}

resource "google_project_iam_binding" "api_sql_client" {
resource "google_project_iam_member" "api_sql_client" {
project = data.google_project.project.project_id
role = "roles/cloudsql.client"
members = [
"serviceAccount:${google_service_account.api.email}"
]
member = "serviceAccount:${google_service_account.api.email}"
}

resource "google_project_iam_binding" "api_secrets_manager" {
resource "google_project_iam_member" "api_secrets_manager" {
project = data.google_project.project.project_id
role = "roles/secretmanager.secretAccessor"
members = [
"serviceAccount:${google_service_account.api.email}"
]
member = "serviceAccount:${google_service_account.api.email}"
}

resource "random_password" "jwt_secret" {
Expand Down
3 changes: 3 additions & 0 deletions opentofu/misc.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,7 @@ resource "google_compute_project_metadata" "enable_oslogin" {
enable-oslogin = "TRUE"
enable-oslogin-2fa = "TRUE"
}
lifecycle {
ignore_changes = [metadata]
}
}

0 comments on commit d1a6776

Please sign in to comment.