terraform-google-nomad icon indicating copy to clipboard operation
terraform-google-nomad copied to clipboard

Errors and other alerts when following the tutorial steps

Open ismarsantos opened this issue 2 years ago • 2 comments

In step 4, right after executing the command 'terraform plan...' I have the output below, please how can I solve this problem?

Terraform v0.12.28

  • provider.google v3.65.0
  • provider.local v2.1.0
  • provider.random v3.1.0
  • provider.template v2.2.0
  • provider.tls v3.1.0

Warning: registry.terraform.io: This version of Terraform has an outdated GPG key and is unable to verify new provider releases. Please upgrade Terraform to at least 0.12.31 to receive new provider updates. For details see: https://discuss.hashicorp.com/t/hcsec-2021-12-codecov-security-event-and-hashicorp-gpg-key-exposure/23512

Error: Reference to undeclared output value

on outputs.tf line 4, in output "ca_cert": 4: value = module.nomad.ca_cert

An output value with the name "ca_cert" has not been declared in module.nomad.

Error: Reference to undeclared output value

on outputs.tf line 10, in output "cli_cert": 10: value = module.nomad.cli_cert

An output value with the name "cli_cert" has not been declared in module.nomad.

Error: Reference to undeclared output value

on outputs.tf line 16, in output "cli_key": 16: value = module.nomad.cli_key

An output value with the name "cli_key" has not been declared in module.nomad.

Error: Reference to undeclared output value

on outputs.tf line 38, in output "nomad_server_ip": 38: value = module.nomad.nomad_server_ip

An output value with the name "nomad_server_ip" has not been declared in module.nomad.


Terraform v0.12.31

  • provider.google v3.65.0
  • provider.local v2.1.0
  • provider.random v3.1.0
  • provider.template v2.2.0
  • provider.tls v3.1.0

Error: Reference to undeclared output value

on outputs.tf line 4, in output "ca_cert": 4: value = module.nomad.ca_cert

An output value with the name "ca_cert" has not been declared in module.nomad.

Error: Reference to undeclared output value

on outputs.tf line 10, in output "cli_cert": 10: value = module.nomad.cli_cert

An output value with the name "cli_cert" has not been declared in module.nomad.

Error: Reference to undeclared output value

on outputs.tf line 16, in output "cli_key": 16: value = module.nomad.cli_key

An output value with the name "cli_key" has not been declared in module.nomad.

Error: Reference to undeclared output value

on outputs.tf line 38, in output "nomad_server_ip": 38: value = module.nomad.nomad_server_ip

An output value with the name "nomad_server_ip" has not been declared in module.nomad.


Terraform v1.1.9 on linux_amd64

  • provider registry.terraform.io/hashicorp/google v4.20.0
  • provider registry.terraform.io/hashicorp/local v2.2.2
  • provider registry.terraform.io/hashicorp/random v3.1.3
  • provider registry.terraform.io/hashicorp/template v2.2.0
  • provider registry.terraform.io/hashicorp/tls v3.3.0

│ Warning: Argument is deprecated │ │ with module.nomad.tls_self_signed_cert.consul-ca, │ on .terraform/modules/nomad/consul_tls_ca.tf line 10, in resource "tls_self_signed_cert" "consul-ca": │ 10: key_algorithm = tls_private_key.consul-ca.algorithm │ │ This is now ignored, as the key algorithm is inferred from the private_key_pem. │ │ (and 13 more similar warnings elsewhere) ╵ ╷ │ Error: Unsupported attribute │ │ on outputs.tf line 4, in output "ca_cert": │ 4: value = module.nomad.ca_cert │ ├──────────────── │ │ module.nomad is a object, known only after apply │ │ This object does not have an attribute named "ca_cert". ╵ ╷ │ Error: Unsupported attribute │ │ on outputs.tf line 10, in output "cli_cert": │ 10: value = module.nomad.cli_cert │ ├──────────────── │ │ module.nomad is a object, known only after apply │ │ This object does not have an attribute named "cli_cert". ╵ ╷ │ Error: Unsupported attribute │ │ on outputs.tf line 16, in output "cli_key": │ 16: value = module.nomad.cli_key │ ├──────────────── │ │ module.nomad is a object, known only after apply │ │ This object does not have an attribute named "cli_key". ╵ ╷ │ Error: Unsupported attribute │ │ on outputs.tf line 38, in output "nomad_server_ip": │ 38: value = module.nomad.nomad_server_ip │ ├──────────────── │ │ module.nomad is a object, known only after apply │ │ This object does not have an attribute named "nomad_server_ip".

ismarsantos avatar May 13 '22 04:05 ismarsantos

👋 Hello!

There are two problems manifesting here.

The usage of key_algorithm is deprecated.

$ terraform plan
â•·
│ Warning: Argument is deprecated
│ 
│   with module.nomad.tls_self_signed_cert.consul-ca,
│   on .terraform/modules/nomad/consul_tls_ca.tf line 10, in resource "tls_self_signed_cert" "consul-ca":
│   10:   key_algorithm   = tls_private_key.consul-ca.algorithm
│ 
│ This is now ignored, as the key algorithm is inferred from the `private_key_pem`.
│ 
│ (and 13 more similar warnings elsewhere)
╵
...

Any cases where key_algorithm is used, we can drop it, and it'll be inferred from private_key_pem. If I understand correctly, this shouldn't actually block usage of the module -- it's just a warning. But, it's something we should fix.

Module output changed.

$ terraform plan
â•·
│ Error: Unsupported attribute
│ 
│   on outputs.tf line 4, in output "ca_cert":
│    4:   value       = module.nomad.ca_cert
│     ├────────────────
│     │ module.nomad is a object, known only after apply
│ 
│ This object does not have an attribute named "ca_cert".
╵

The module outputs in the example directory has some old information. We need to update it. Would look something like:

output "ca_cert" {
  sensitive   = true
  description = "The TLS CA certificate used for CLI authentication."
  value       = module.nomad.nomad_ca_cert
}

output "cli_cert" {
  sensitive   = true
  description = "The TLS certificate used for CLI authentication."
  value       = module.nomad.nomad_cli_cert
}

output "cli_key" {
  sensitive   = true
  description = "The TLS private key used for CLI authentication."
  value       = module.nomad.nomad_cli_key
}

output "nomad_server_ip" {
  description = "The Nomad server private IP."
  value       = module.nomad.server_internal_ips
}

output "load_balancer_ip" {
  description = "The external ip address of the load balacner"
  value       = module.nomad.load_balancer_ip
}

picatz avatar May 16 '22 19:05 picatz

We also need to drop usage of ca_ key_algorithm in addition to key_algorithm.

picatz avatar Oct 20 '22 21:10 picatz

Thank you for the report, and apologies for the delay in fixing this (https://github.com/picatz/terraform-google-nomad/pull/59/commits/87d6c08945f11407a8948c0b6c26837e22725480). 😄

picatz avatar Feb 08 '23 01:02 picatz