Skip to content

Add resource to add secrets to secret manager #1473

@dome-meg

Description

@dome-meg

Problem description

I create a user via terraform for our postgres DB.

resource "stackit_postgresflex_user" "user" {
  project_id  = var.project_id
  instance_id = stackit_postgresflex_instance.main.instance_id
  username    = "project_${var.environment}_user"
  roles       = ["login"]
}

The resource expose some important outputs:

  • stackit_postgresflex_user.user.uri
  • stackit_postgresflex_user.user.password

To get access to the password:

  • They are not readable in the portal and so I can only recreate a new password in the portal to see it.
  • I export it with terraform apply

Proposed solution

# ALREADY EXISTING:

resource "stackit_secretsmanager_instance" "example" {
  project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
  name       = "example-instance"
  acls       = ["XXX.XXX.XXX.X/XX", "XX.XXX.XX.X/XX"]
}
resource "stackit_secretsmanager_secret" "database_uri" {
  project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
  instance_id = stackit_secretsmanager_instance.example.instance_id
  name       = "our database credentials"
  secrets = {
    db_uri = stackit_postgresflex_user.user.uri
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions