Skip to content

Importing existing accounts

Accounts created in the PruneOps web app can be brought under Terraform.

List them with their ids:

data "pruneops_cloud_accounts" "all" {}

output "account_ids" {
  value = { for a in data.pruneops_cloud_accounts.all.accounts : a.name => a.id }
}

Write the resource block and import it (Terraform 1.5+ import blocks work too):

terraform import pruneops_cloud_account.aws_prod <account id>
terraform import pruneops_cloud_account_resource_policy.aws_prod <account id>
terraform import pruneops_terraform_config.prod_states <config id>

PruneOps never returns credentials nor the non-secret settings, so after importing an account the first terraform apply shows an update: it sends settings and credentials_wo from your configuration. Everything else is read back and should match.