Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vault_database_secret_backend_connection don't accept plugin_name key #607

Closed
JnMik opened this issue Nov 14, 2019 · 14 comments
Closed

vault_database_secret_backend_connection don't accept plugin_name key #607

JnMik opened this issue Nov 14, 2019 · 14 comments
Milestone

Comments

@JnMik
Copy link

JnMik commented Nov 14, 2019

Terraform Version

vault v0.12.12
provider.vault v2.6.0

Affected Resource(s)

vault_database_secret_backend_connection

Terraform Configuration Files

resource "vault_database_secret_backend_connection" "mongodb-atlas" {
  backend       = "${vault_mount.mongodb-atlas.path}"
  name          = "mongodb-atlas"
  allowed_roles = [
      ...  
  ]

  plugin_name = "mongodb-atlas-plugin"

  data = {
    public_key = "xxx"
    private_key = "xxx"
    project_id = "xxx"
  }
}

Expected Behavior

Resource should accept plugin_name property to pass custom plugins

Actual Behavior

An argument named "plugin_name" is not expected here.

I also tried with plugin_name in the data field but had the error Error: at least one database plugin must be configured

@whume
Copy link

whume commented May 18, 2020

Is there an update on this now that mongodb atlas is officially supported it would be good if we could use terraform for this.

@iiro
Copy link

iiro commented Jul 15, 2021

Any updates on this...? Definitely needed for managing the setup with Terraform...

@angeloskaltsikis
Copy link

@iiro According to the docs i believe that while there is no way to currently specify which plugin you want, you can use the specific blocks (for example mysql or aurora_rds) to specify which plugin you want to use.
Makes sense to you?

@benashz
Copy link
Contributor

benashz commented Jan 29, 2022

Closed by #1320

@benashz benashz closed this as completed Jan 29, 2022
@pedroduarteid
Copy link

Hi @benashz, how are you?

I have configured my terraform file by passing the value "plugin_name" but it is not recognized in the "terraform plan" command. I'm using version 3.2.1 (required provider - main.tf) in my code.

How do I make use of this feature?

This is my block code resource.

resource "vault_database_secret_backend_connection" "mongodbatlas" {
    backend = vault_mount.mongodbatlas.path

    plugin_name = "mongodbatlas-database-plugin"
    name = var.mount_name
    allowed_roles = [var.role_name]
}

My config Terraform

Terraform v1.1.6
Provider Vault - 3.2.1
Vault - v1.9.3

image

I tried without passing "plugin_name" and result is:

image

I appreciate your support! Thanks.

@benashz
Copy link
Contributor

benashz commented Feb 17, 2022

Hi @pedroduarteid , this is fixed in https://github.com/hashicorp/terraform-provider-vault/releases/tag/v3.3.0 . Please let us know if you continue to encounter this issue.

Thanks,

Ben

@pedroduarteid
Copy link

Hi @benashz
I will evaluate it today and as soon as I have the result I will update you here.

Thanks,
Pedro

@pedroduarteid
Copy link

pedroduarteid commented Feb 18, 2022

Hi @benashz

I evaluated and the command "terraform apply" shows the error below.

image

Using the "vault write..." command I configured the database engine to mongodbatlas normally. However, I believe there is some configuration missing to be able to run through terraform. But I could not find any parameters for that.

image

image

Documents I've consulted.:
https://registry.terraform.io/providers/hashicorp/vault/latest/docs/resources/database_secret_backend_connection
https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs

@benashz
Copy link
Contributor

benashz commented Feb 18, 2022

HI @pedroduarteid ,

I think you might be missing database specific configuration. See https://registry.terraform.io/providers/hashicorp/vault/latest/docs/resources/database_secret_backend_connection#mongodb-atlas-configuration-options for more details.

@pedroduarteid
Copy link

I believed that not...
I have trying before used these options but have errors.

By the best pratices not is correct to be use credentials in the configurations files...

I have tried several ways to use these parameters and it is not accepted by "terraform plan...apply"...etc...

image

image

image

image

@benashz
Copy link
Contributor

benashz commented Feb 18, 2022

I think you only need to move public_key and private_key into the resource's mongodbatlas block:

Example:

resource "vault_database_secret_backend_connection" "test" {
  backend = vault_mount.db.path
  name = "...."

  mongodbatlas {
    public_key  = "your public key"
    private_key = "your private key"
    project_id  = "your project ID"
  }
}

@pedroduarteid
Copy link

Same error. I made this configuration.
This point of configuration is provider of MongoDBAtlas, not of Vault.

image

@benashz
Copy link
Contributor

benashz commented Feb 18, 2022

You need to pass a string for all those fields. What you have there are lists, which is not what the provider expects.

@benashz benashz added this to the 3.3.0 milestone Feb 18, 2022
@pedroduarteid
Copy link

Yes, @benashz
It is now possible to perform the configuration in Vault through Terraform.

image

The values are passing in time of execution with "terraform apply" to nothing save inside files config.

image

image

Thanks!
Pedro Duarte

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants