Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

456
Views
terraform: No se ha declarado una variable de entrada con el nombre "AMI". Esta variable se puede declarar con un bloque variable "AMI" {}

Soy nuevo en terraformar. Estaba probando mi granito de arena en terrafrom

Tengo este bit en var.tfvars

 variable "AWS_REGION" { default = "me-south-1" } variable "AMI" { type = "map" default ={ me-south-1 = "ami-01b735b798*******" us-east-1 = "ami-0c2a1acae666******" } }

y estoy tratando de crear un ec2 en VPC por

 resource "aws_instance" "terraform-web" { ami = "${lookup(var.AMI, var.AWS_REGION)}" instance_type = "t3.micro"

que me está dando el error mencionado anteriormente.

Alguien podría ayudarme con esto ?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

La forma en que funciona terraform es:

variables.tf -- todas las variables se declaran en este archivo

vars.tfvars: todos los valores se pasan a través de este archivo. El nombre puede ser cualquier cosa. debe terminar con tfvars.

¡No necesita usar la búsqueda, solo var. <variable_name> es suficiente!

ec2.tf:

 resource "aws_instance" "terraform-web" { ami = var.ami_id instance_type = "t3.micro" }

variables.tf

 variable "ami_id" { type = "string" default = "xxxx" }

vars.tfvars

 ami_id = "yyyyy"
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!