Vishwas M.R
Vishwas M.R

Reputation: 1669

Terraform: cat command issues

I have Terraform 0.13.5 installed on RHEL 8.3 AWS EC2 instance. I have a single file in my directory "main.tf" whose contents are as follows:

variable "myvar" {
        type = string
        default = "Hello Terraform!"
}

variable "mymap" {
        type = map(string)
        default = {
                mykey = "my value"
                }
}

variable "mylist" {
        type = list
        default = [1,2,3]
}

I have validated the syntax using "terrafom validate" command:

ec2-user@ip-172-31-XX-XX check]$ terraform validate
Success! The configuration is valid.

However, I cannot successfully run the "cat" command within the "Terraform Console":

[ec2-user@ip-172-31-XX-XX check]$ terraform console
> cat main.tf

>
Error: Extra characters after expression

  on <console-input> line 1:
  (source code not available)

An expression was successfully parsed, but extra characters were found after
it.

>

> exit

Please let me know what I'm missing here.

Upvotes: 1

Views: 705

Answers (1)

Marcin
Marcin

Reputation: 238299

If you want to display the content of the file you just write:

file("main.tf")

To get individual variables, e.g.:

var.myvar

Sadly, I'm not sure what do you want to achieve with a cat command. There is no such command in terraform console.

Upvotes: 2

Related Questions