Skip to content

Using Variables #12

@Soolaa

Description

@Soolaa

Hi.
I am using variables in the variable.tf file and trying to read the data of it. But even if I leave the variable without a default value, when "terraform plan" command is running, It has a value and seems not using of variables.tf file. what is the problem? I will appreciate.
variables.tf file:
variable "ami_id" {}
variable "instance_type" {}

main.tf file:
resource "aws_instance" "Sahar" {
ami = var.ami_id
instance_type = var.instance_type

terraform apply result:

aws_instance.Sahar will be created

  • resource "aws_instance" "Sahar" {
    • ami = "ami-0557a15b87f6559cf"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions