-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add support for Google provider v5
Google provider v5 enforced a change in how automatic replication was specified; this change makes the `automatic` => `auto` stanza change and supports setting a KMS key for Google-managed replication with a user provided KMS key through the variable `auto_replication_kms_key_name`. The newer versions of Google provider also support `annotations` in addition to `labels`; this commit adds an optional `annotations` variable. Closes #76
- Loading branch information
Showing
20 changed files
with
182 additions
and
33 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
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,24 @@ | ||
# Automatic Replication with | ||
|
||
This example shows how to allow Google to automatically manage secret replication across locations, and use a Cloud KMS | ||
encryption key to use for secret encryption. | ||
|
||
## Example at a glance | ||
|
||
|Item|Managed by Terraform|Description| | ||
|----|--------------------|-----------| | ||
|Access Control||Not managed by example; permissions to read the secret must be specified externally.| | ||
|Cloud KMS key||Not managed by example; a suitable KMS key for encryption/decryption must be created externally in global location.| | ||
|Replication|✓|Automatically managed by Secret Manager.| | ||
|Secret Value||User specified.| | ||
|
||
<!-- spell-checker: disable --> | ||
### Example terraform.tfvars | ||
|
||
```properties | ||
# Example TF vars file | ||
project_id = "my-project-id" | ||
id = "my-secret-id" | ||
secret = "T0pS3cretP@ssword!" | ||
auto_replication_kms_key_name = "projects/my-project-id/locations/global/keyRings/my-global-keyring/cryptoKeys/global-key" | ||
``` |
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,20 @@ | ||
# This file demonstrates applying user-defined replication options with customer | ||
# managed encryption keys from Cloud KMS. | ||
terraform { | ||
required_version = ">= 0.14.5" | ||
required_providers { | ||
google = { | ||
source = "hashicorp/google" | ||
version = ">= 4.83" | ||
} | ||
} | ||
} | ||
|
||
module "secret" { | ||
source = "memes/secret-manager/google" | ||
version = "2.2.0" | ||
project_id = var.project_id | ||
id = var.id | ||
secret = var.secret | ||
auto_replication_kms_key_name = var.auto_replication_kms_key_name | ||
} |
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,7 @@ | ||
output "id" { | ||
value = module.secret.id | ||
} | ||
|
||
output "secret_id" { | ||
value = module.secret.secret_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,5 @@ | ||
# Example TF vars file | ||
project_id = "my-project-id" | ||
id = "my-secret-id" | ||
secret = "T0pS3cretP@ssword!" | ||
auto_replication_kms_key_name = "projects/my-project-id/locations/global/keyRings/my-global-keyring/cryptoKeys/global-key" |
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,27 @@ | ||
variable "project_id" { | ||
type = string | ||
description = <<EOD | ||
The GCP project identifier where the secret will be created. | ||
EOD | ||
} | ||
|
||
variable "id" { | ||
type = string | ||
description = <<EOD | ||
The secret identifier to create; this value must be unique within the project. | ||
EOD | ||
} | ||
|
||
variable "auto_replication_kms_key_name" { | ||
type = string | ||
description = <<EOD | ||
The Cloud KMS key name to use with Google managed replication. | ||
EOD | ||
} | ||
|
||
variable "secret" { | ||
type = string | ||
description = <<EOD | ||
The secret payload to store in Secret Manager. | ||
EOD | ||
} |
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
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
Oops, something went wrong.