-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Created a new service account with 2 roles permissions: Logging Admin and Monitoring Metric Writer - Attached the services account to the VM (refer the compute_instance folder) - Created a module for Cloud DNS to translate my API Domain Address to IP Address to access the VM in GCP
- Loading branch information
Showing
14 changed files
with
125 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
resource "google_dns_record_set" "webapp_dns_records" { | ||
name = var.webapp_domain_name | ||
type = var.webapp_dnsrecord_type | ||
ttl = var.webapp_dns_ttl | ||
managed_zone = var.managed_zone_webapp | ||
|
||
rrdatas = [var.global_ip] | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
variable "webapp_domain_name" { | ||
description = "The domain name for the web application" | ||
type = string | ||
} | ||
|
||
variable "webapp_dnsrecord_type" { | ||
description = "The type of DNS record" | ||
type = string | ||
} | ||
|
||
variable "webapp_dns_ttl" { | ||
description = "The TTL for the DNS record" | ||
type = number | ||
} | ||
|
||
variable "managed_zone_webapp" { | ||
description = "The managed zone for the web application" | ||
type = string | ||
} | ||
|
||
variable "global_ip" { | ||
description = "The global IP address for the web application" | ||
type = string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
resource "google_project_iam_binding" "logging_admin" { | ||
project = var.project_id | ||
role = "roles/logging.admin" | ||
|
||
members = [ | ||
"serviceAccount:${var.service_account_email}" | ||
] | ||
} | ||
|
||
resource "google_project_iam_binding" "monitoring_metric_writer" { | ||
project = var.project_id | ||
role = "roles/monitoring.metricWriter" | ||
|
||
members = [ | ||
"serviceAccount:${var.service_account_email}" | ||
] | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
variable "project_id" { | ||
description = "The project ID to bind roles" | ||
type = string | ||
} | ||
|
||
variable "service_account_email" { | ||
description = "The email of the service account" | ||
type = string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
resource "google_service_account" "vm_service_account" { | ||
account_id = var.account_id | ||
display_name = var.display_name | ||
project = var.project_id | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
output "email" { | ||
value = google_service_account.vm_service_account.email | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
variable "account_id" { | ||
description = "The account ID of the service account" | ||
type = string | ||
} | ||
|
||
variable "display_name" { | ||
description = "The display name of the service account" | ||
type = string | ||
} | ||
|
||
variable "project_id" { | ||
description = "The project ID where the service account will be created" | ||
type = string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters