Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Input variable prompt is missing in latest version #3737

Closed
saswatp opened this issue Nov 3, 2015 · 7 comments · Fixed by #3843
Closed

Input variable prompt is missing in latest version #3737

saswatp opened this issue Nov 3, 2015 · 7 comments · Fixed by #3843

Comments

@saswatp
Copy link

saswatp commented Nov 3, 2015

When using latest version terraform doesn't prompt to enter value of a variable if I don't provide a variable value using -var 'key=value' option. It just throws an error saying variable value is not set.

Again , this used to work in 0.5.3 version .

@saswatp
Copy link
Author

saswatp commented Nov 3, 2015

cat infrastructure_aws_module.tf
variable access_key {}
variable secret_key {}
variable region {}
variable availability_zones { default = "us-east-1a,us-east-1b" }
variable bastion_host_subnet { default = "10.0.0.0/24,10.0.1.0/24" }
variable deployment_host_subnet { default = "10.0.2.0/24,10.0.3.0/24" }
variable artifactory_host_subnet { default = "10.0.4.0/24" }
variable ssh_private_key { default = "/.ssh/id_rsa" }
variable ssh_public_key { default = "
/.ssh/id_rsa.pub" }

provider "aws" {
access_key = "${var.access_key}"
secret_key = "${var.secret_key}"
region = "${var.region}"
}

module "aws-dc" {
source = "./terraform/aws/"

#Initialization for all resource types
datacenter = "aws"
long_name = "sbg-infrastructure"
short_name = "sbg"
source_ami = "ami-6d8bd608"
ssh_key = "~/.ssh/id_rsa.pub"
ssh_private_key = "~/.ssh/id_rsa"
ssh_username = "centos"
availability_zones = "us-east-1a,us-east-1b"

#Artifactory Specific
artifactory_count = "1"
artifactory_type = "t2.small"
artifactory_ssh_cidr_block = "0.0.0.0/0"
artifactory_webport_cidr_block = "0.0.0.0/0"
artifactory_icmp_cidr_block = "0.0.0.0/0"
artifactory_host_subnet = "${var.artifactory_host_subnet}"
volume_size = "20"

#Bastion Specific 
bastion_host_type = "t2.micro"
bastion_host_count = "2"
bastion_ssh_cidr_block = "0.0.0.0/0"
bastion_icmp_cidr_block = "0.0.0.0/0"
bastion_host_subnet = "${var.bastion_host_subnet}"

#Deployment host Specific
deployment_host_type = "t2.micro"
deployment_host_count = "2"
deployment_host_subnet = "${var.deployment_host_subnet}"

}

output "bastion_private_ips" {
value = "${module.aws-dc.bastion_private_ips}"
}

output "artifactory_private_ips" {
value = "${module.aws-dc.artifactory_private_ips}"
}

output "deployment_host_private_ips" {
value = "${module.aws-dc.deployment_host_private_ips}"
}

output "bastion_public_ip" {
value = "${module.aws-dc.bastion_public_ip}"
}

output "artifactory_public_ip" {
value = "${module.aws-dc.artifactory_public_ip}"
}

output "vpc_id" {
value = "${module.aws-dc.vpc_id}"
}

output "network" {
value = "${module.aws-dc.network}"
}

output "region" {
value = "${var.region}"
}

Output when I ran terraform plan . In 0.5.3 it used to prompt the user to input value for these variables.

terraform plan

There are warnings and/or errors related to your configuration. Please
fix these before continuing.

Errors:

  • 3 error(s) occurred:
  • Required variable not set: access_key
  • Required variable not set: region
  • Required variable not set: secret_key

@saswatp saswatp changed the title Input variable prompt is missing in 0.6.5 version Input variable prompt is missing in latest version Nov 3, 2015
@stack72
Copy link
Contributor

stack72 commented Nov 3, 2015

@saswatp terraform plan and apply have an option called input

This has been changed to be set to false (as of 0.6.0)

Therefore, the command should now be as follows:

terraform plan --input=true

That will then prompt you for the values

@phinze
Copy link
Contributor

phinze commented Nov 4, 2015

This might still be a bug. I'm fairly certain that the intended behavior here is still to prompt on unset variables.

Tagging as a core bug and we'll take a look.

A minimal config that reproduces on master:

variable "ak" {}
variable "sk" {}
variable "re" {}
variable "ihaveadefault" { default = "yup" }

provider "aws" {
  access_key = "${var.ak}"
  secret_key = "${var.sk}"
  region = "${var.re}"
}

resource "aws_vpc" "foo" {
  cidr_block = "10.11.12.0/24"
}

@jen20
Copy link
Contributor

jen20 commented Nov 10, 2015

I can reproduce this with master during plan, but not during apply currently. I'll investigate further tomorrow, as I think the expected behaviour is the same across both plan and apply.

@jen20
Copy link
Contributor

jen20 commented Nov 10, 2015

This is now fixed on master and will be included in version 0.6.7. Thanks for the report @saswatp!

@jen20 jen20 closed this as completed Nov 10, 2015
@saswatp
Copy link
Author

saswatp commented Nov 12, 2015

@jen20 - Thanks for the fix.

@ghost
Copy link

ghost commented Apr 30, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants