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

Revert "Supporting custom project ID, outputting service account JSON" #158

Merged
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
9 changes: 2 additions & 7 deletions nomad-gcp/nomad-autoscaler.tf
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
### SERVICE ACCOUNT ###
data "google_project" "project" {
count = var.project_id == "" ? 1 : 0
}

locals {
project_id = var.project_id == "" ? data.google_project.project[0].project_id : var.project_id
}

resource "google_service_account" "nomad_as_service_account" {
count = var.nomad_auto_scaler ? 1 : 0

project = local.project_id
project = data.google_project.project.project_id
account_id = "${var.name}-nomad-autoscaler-sa"
display_name = "${var.name}-nomad-autoscaler-sa"
description = "${var.name} service account for CircleCI Server cluster component"
Expand All @@ -33,7 +28,7 @@ resource "google_service_account_iam_binding" "nomad_as_work_identity_k8s" {
service_account_id = google_service_account.nomad_as_service_account[0].name
role = "roles/iam.workloadIdentityUser"
members = [
"serviceAccount:${local.project_id}.svc.id.goog[${var.k8s_namespace}/nomad-autoscaler]",
"serviceAccount:${data.google_project.project.project_id}.svc.id.goog[${var.k8s_namespace}/nomad-autoscaler]",
]
}

Expand Down
6 changes: 0 additions & 6 deletions nomad-gcp/output.tf
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@ output "managed_instance_group_zone" {
value = google_compute_instance_group_manager.nomad.zone
}

output "service_account_key" {
value = base64decode(google_service_account_key.nomad-as-key[0].private_key)
sensitive = true
description = "Base64 decoded service account key."
}

output "service_account_key_location" {
value = var.enable_workload_identity ? "" : "${path.cwd}/nomad-as-key.json"
}
Expand Down
6 changes: 0 additions & 6 deletions nomad-gcp/variables.tf
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
variable "project_id" {
type = string
description = "GCP project ID to deploy resources into. By default uses the data sourced GCP project ID."
default = ""
}

variable "zone" {
type = string
description = "GCP compute zone to deploy nomad clients into (e.g us-east1-a)"
Expand Down