hashicorp / terraform-provider-google

Terraform Provider for Google Cloud Platform
https://registry.terraform.io/providers/hashicorp/google/latest/docs
Mozilla Public License 2.0
2.36k stars 1.75k forks source link

ephemeral resource: add google_secret_manager_secret_version support #20516

Open rd-michel opened 6 days ago

rd-michel commented 6 days ago

Community Note

Description

We would like to use the new feature "ephemeral resources" to hide sensitive data/secrets in the terraform state

New or Affected Resource(s)

Potential Terraform Configuration

ephemeral "google_secret_manager_secret_version" "smtp-monitoring-password" {
  project = "gcp-test-project"
  secret  = "smtp-monitoring-password"
}

resource "kubernetes_secret" "smtp-monitoring" {
  metadata {
    name      = "smtp-monitoring"
    namespace = "monitoring"
  }

  data = {
    host     = "smtp.gmail.com"
    port     = 587
    username = "monitoring@testdomain.com"
    password = ephemeral.google_secret_manager_secret_version.smtp-monitoring-password.secret_data
  }
}

References

https://www.hashicorp.com/blog/terraform-1-10-improves-handling-secrets-in-state-with-ephemeral-values https://developer.hashicorp.com/terraform/language/resources/ephemeral

rileykarson commented 2 days ago

Note: exempt from forwarding until we define the self-service contribution process