MEDIUM
Source
Trivy
ID
AVD-OPNSTK-0001

No plaintext password for compute instance

Assigning a password to the compute instance using plaintext could lead to compromise; it would be preferable to use key-pairs as a login mechanism

Impact

Follow the appropriate remediation steps below to resolve the issue.

Do not use plaintext passwords in terraform files

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
resource "openstack_compute_instance_v2" "good_example" {
  name            = "basic"
  image_id        = "ad091b52-742f-469e-8f3c-fd81cadf0743"
  flavor_id       = "3"
  key_pair        = "my_key_pair_name"
  security_groups = ["default"]
  user_data       = "#cloud-config\nhostname: instance_1.example.com\nfqdn: instance_1.example.com"

  network {
    name = "my_network"
  }
}