The Lastpass provider is used to read, manage, or destroy secrets inside Lastpass. Goodbye secret .tfvars files 👋
terraform {
required_providers {
random = {
source = "hashicorp/random"
version = "3.1.0"
}
lastpass = {
source = "neticdk/lastpass"
version = "~> 1.0"
}
}
}
provider lastpass {
baseurl = "https://lastpass.eu"
trust = true
enable_2fa = true
}
resource "random_password" "pw" {
length = 32
special = false
}
resource "lastpass_secret" "mysecret" {
name = "My site"
username = "foobar"
password = random_password.pw.result
share = "Shared-TeamX"
url = "https://example.com"
notes = <<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
}
data "lastpass_secret" "mysecret" {
id = resource.lastpass_secret.mysecret.id
}
Documentation and examples can be found inside the Terraform registry: