-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
121 additions
and
65 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
terraform { | ||
backend "gcs" {} | ||
} | ||
|
||
module "storage" { | ||
source = "../storage" | ||
|
||
project_id = var.project_id | ||
base_name = var.base_name | ||
location = var.location | ||
} | ||
|
||
module "secretmanager" { | ||
source = "../secretmanager" | ||
} |
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 @@ | ||
output "ecdsa_p256_public_key_id" { | ||
description = "Signer public key (P256_SHA256)" | ||
value = module.secretmanager.ecdsa_p256_public_key_id | ||
} | ||
|
||
output "ecdsa_p256_private_key_id" { | ||
description = "Signer private key (P256_SHA256)" | ||
value = module.secretmanager.ecdsa_p256_private_key_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,14 @@ | ||
variable "project_id" { | ||
description = "GCP project ID where the log is hosted" | ||
type = string | ||
} | ||
|
||
variable "base_name" { | ||
description = "Base name to use when naming resources" | ||
type = string | ||
} | ||
|
||
variable "location" { | ||
description = "Location in which to create resources" | ||
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,69 @@ | ||
terraform { | ||
required_providers { | ||
google = { | ||
source = "registry.terraform.io/hashicorp/google" | ||
version = "6.1.0" | ||
} | ||
} | ||
} | ||
|
||
# Secret Manager | ||
|
||
# ECDSA key with P256 elliptic curve. Do NOT use this in production environment. | ||
# | ||
# Security Notice | ||
# The private key generated by this resource will be stored unencrypted in your | ||
# Terraform state file. Use of this resource for production deployments is not | ||
# recommended. Instead, generate a private key file outside of Terraform and | ||
# distribute it securely to the system where Terraform will be run. | ||
# | ||
# See https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key. | ||
resource "google_project_service" "secretmanager_googleapis_com" { | ||
service = "secretmanager.googleapis.com" | ||
disable_on_destroy = false | ||
} | ||
|
||
resource "tls_private_key" "sctfe_ecdsa_p256" { | ||
algorithm = "ECDSA" | ||
ecdsa_curve = "P256" | ||
} | ||
|
||
resource "google_secret_manager_secret" "sctfe_ecdsa_p256_public_key" { | ||
secret_id = "sctfe-ecdsa-p256-public-key" | ||
|
||
labels = { | ||
label = "sctfe-public-key" | ||
} | ||
|
||
replication { | ||
auto {} | ||
} | ||
|
||
depends_on = [google_project_service.secretmanager_googleapis_com] | ||
} | ||
|
||
resource "google_secret_manager_secret_version" "sctfe_ecdsa_p256_public_key" { | ||
secret = google_secret_manager_secret.sctfe_ecdsa_p256_public_key.id | ||
|
||
secret_data = tls_private_key.sctfe_ecdsa_p256.public_key_pem | ||
} | ||
|
||
resource "google_secret_manager_secret" "sctfe_ecdsa_p256_private_key" { | ||
secret_id = "sctfe-ecdsa-p256-private-key" | ||
|
||
labels = { | ||
label = "sctfe-private-key" | ||
} | ||
|
||
replication { | ||
auto {} | ||
} | ||
|
||
depends_on = [google_project_service.secretmanager_googleapis_com] | ||
} | ||
|
||
resource "google_secret_manager_secret_version" "sctfe_ecdsa_p256_private_key" { | ||
secret = google_secret_manager_secret.sctfe_ecdsa_p256_private_key.id | ||
|
||
secret_data = tls_private_key.sctfe_ecdsa_p256.private_key_pem | ||
} |
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 @@ | ||
output "ecdsa_p256_public_key_id" { | ||
description = "Signer public key (P256_SHA256)" | ||
value = google_secret_manager_secret_version.sctfe_ecdsa_p256_public_key.id | ||
} | ||
|
||
output "ecdsa_p256_private_key_id" { | ||
description = "Signer private key (P256_SHA256)" | ||
value = google_secret_manager_secret_version.sctfe_ecdsa_p256_private_key.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