Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IV-164] Add roles required for ops-agent #11

Merged
merged 2 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ No requirements.

| Name | Version |
|------|---------|
| <a name="provider_google"></a> [google](#provider\_google) | 6.9.0 |
| <a name="provider_google"></a> [google](#provider\_google) | 6.16.0 |

## Modules

Expand All @@ -31,6 +31,8 @@ No modules.
| [google_compute_firewall.ssh](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_firewall) | resource |
| [google_compute_instance.this](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_instance) | resource |
| [google_compute_instance_group.this](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_instance_group) | resource |
| [google_project_iam_member.this](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/project_iam_member) | resource |
| [google_service_account.this](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/service_account) | resource |
| [google_compute_image.this](https://registry.terraform.io/providers/hashicorp/google/latest/docs/data-sources/compute_image) | data source |

## Inputs
Expand Down
20 changes: 20 additions & 0 deletions backend/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ data "google_compute_image" "this" {
project = var.project
}

locals {
roles = [
"roles/logging.logWriter",
"roles/monitoring.metricWriter"
]
}

resource "google_compute_instance" "this" {
name = var.name
boot_disk {
Expand Down Expand Up @@ -45,3 +52,16 @@ resource "google_compute_instance_group" "this" {
project = var.project
zone = "${var.region}-${var.region_zone}"
}

resource "google_service_account" "this" {
account_id = "backend"
display_name = "Roles for Backend"
project = var.project
}

resource "google_project_iam_member" "this" {
for_each = toset(local.roles)
member = "serviceAccount:${google_service_account.this.email}"
project = var.project
role = each.value
}
2 changes: 1 addition & 1 deletion dns_zone/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ No requirements.

| Name | Version |
|------|---------|
| <a name="provider_google"></a> [google](#provider\_google) | 6.9.0 |
| <a name="provider_google"></a> [google](#provider\_google) | 6.16.0 |

## Modules

Expand Down
2 changes: 1 addition & 1 deletion lb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ No requirements.

| Name | Version |
|------|---------|
| <a name="provider_google"></a> [google](#provider\_google) | 6.9.0 |
| <a name="provider_google"></a> [google](#provider\_google) | 6.16.0 |

## Modules

Expand Down
2 changes: 1 addition & 1 deletion network/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ No requirements.

| Name | Version |
|------|---------|
| <a name="provider_google"></a> [google](#provider\_google) | 6.9.0 |
| <a name="provider_google"></a> [google](#provider\_google) | 6.16.0 |

## Modules

Expand Down
2 changes: 1 addition & 1 deletion postgres/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ No requirements.

| Name | Version |
|------|---------|
| <a name="provider_google"></a> [google](#provider\_google) | 6.9.0 |
| <a name="provider_google"></a> [google](#provider\_google) | 6.16.0 |

## Modules

Expand Down
Loading