digitalocean / container-blueprints

DigitalOcean Kubernetes(DOKS) Solution Blueprints
93 stars 46 forks source link

[create-doks-with-terraform-flux] A fix is needed for the default value of the `github_ssh_pub_key` Terraform variable #18

Closed v-ctiutiu closed 2 years ago

v-ctiutiu commented 2 years ago

Description

The default value for the github_ssh_pub_key variable used in the Terraform module to populate the known hosts file for Flux CD contains an invalid value. Currently, the variables.tf file sets the default value like this:

variable "github_ssh_pub_key" {
  description = "GitHub SSH public key"
  type        = string
  default     = "github.com ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEmKSENjQEezOmxkZMy7opKgwFB9nkt5YRrYMjNuG5N87uRgg6CLrbo5wAdT/y6v0mKV0U2w0WZ2YB/++Tpockg="
}

Solution

Remove the redundant "github.com" part form the string. It's already appended by the known_hosts parameter from the data resource inside main.tf file:

data = {
    identity       = tls_private_key.main.private_key_pem
    "identity.pub" = tls_private_key.main.public_key_pem
    known_hosts    = "github.com ${var.github_ssh_pub_key}"
  }