forked from googleapis/google-cloud-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.tf
More file actions
24 lines (24 loc) · 673 Bytes
/
Copy pathmain.tf
File metadata and controls
24 lines (24 loc) · 673 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
terraform {
required_providers {
google = {
source = "hashicorp/google"
}
}
}
resource "google_project_service" "iam" {
service = "iam.googleapis.com"
project = var.inputs.project_id
count = var.inputs.should_enable_apis_on_apply ? 1 : 0
disable_on_destroy = var.inputs.should_disable_apis_on_destroy
}
resource "random_id" "id" {
byte_length = 3
}
locals {
service_account_id = lower("service-account-id-${random_id.id.hex}")
}
resource "google_service_account" "service_account" {
account_id = local.service_account_id
display_name = "Service Account"
depends_on = [google_project_service.iam]
}