nrkno / terraform-provider-lastpass

Terraform Lastpass provider
Apache License 2.0
61 stars 7 forks source link

How to create a secured note? #22

Closed kaushik-xs closed 4 years ago

kaushik-xs commented 4 years ago

We often use secured notes for storing the certificates or sometimes large .env file. Is there a way to store and retrieve them via this provider?

Screenshot 2020-05-17 at 11 48 31 AM
martensson commented 4 years ago

Hi @kaushik-xs I am sorry for the late reply, but is indeed possible and something we do as well. Did you see the README examples? There is one that shows how to create a note:

# secret with password set from string, file, variable, etc.
resource "lastpass_secret" "mysecret" {
    name = "My site"
    username = "foobar"
    password = file("${path.module}/secret")
    url = "https://example.com"
    note = <<EOF
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam sed elit nec orci
cursus rhoncus. Morbi lacus turpis, volutpat in lobortis vel, mattis nec magna.
Cras gravida libero vitae nisl iaculis ultrices. Fusce odio ligula, pharetra ac
viverra semper, consequat quis risus.
EOF
}

Just put whatever data you want in the note, like certificates, keys, etc.

If you want to manually create notes and only retrieve with the provider it is also possible using the data source:

data "lastpass_secret" "mycertificate" {
    id = "1234567890"
}

Where id is the id of the lastpass object you want to retrieve.

Hope it helps!