File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -16,4 +16,29 @@ resource "google_project_iam_member" "terraform_ci_iam_viewer" {
1616 project = var. project_id
1717 role = " roles/iam.serviceAccountViewer"
1818 member = " serviceAccount:${ google_service_account . terraform_ci . email } "
19- }
19+ }
20+
21+ # Permissão CI/CD para a service account do Github Actions
22+ resource "google_project_iam_member" "github_actions_iam_user" {
23+ project = var. project_id
24+ role = " roles/iam.serviceAccountUser"
25+ member = " serviceAccount:${ google_service_account . github_actions_deploy . email } "
26+ }
27+
28+ resource "google_project_iam_member" "github_actions_run_admin" {
29+ project = var. project_id
30+ role = " roles/run.admin"
31+ member = " serviceAccount:${ google_service_account . github_actions_deploy . email } "
32+ }
33+
34+ resource "google_project_iam_member" "github_actions_oidc_token_creator" {
35+ project = var. project_id
36+ role = " roles/iam.serviceAccountTokenCreator"
37+ member = " serviceAccount:${ google_service_account . github_actions_deploy . email } "
38+ }
39+
40+ resource "google_project_iam_member" "github_actions_registry_reader" {
41+ project = var. project_id
42+ role = " roles/storage.objectViewer" # ou roles/artifactregistry.reader se estiver usando Artifact Registry
43+ member = " serviceAccount:${ google_service_account . github_actions_deploy . email } "
44+ }
Original file line number Diff line number Diff line change @@ -4,3 +4,9 @@ resource "google_service_account" "terraform_ci" {
44 display_name = " Terraform CI/CD"
55 description = " Criada pelo módulo infra-base para CI/CD do Terraform"
66}
7+
8+ resource "google_service_account" "github_actions_deploy" {
9+ account_id = " github-actions-deploy"
10+ display_name = " GitHub Actions Deploy"
11+ description = " Criada pelo módulo infra-base para CI/CD via GitHub Actions"
12+ }
You can’t perform that action at this time.
0 commit comments