data "aws_instances" not working in ap-sotheast-1 #17866
Labels
bug
Addresses a defect in current functionality.
service/ec2
Issues and PRs that pertain to the ec2 service.
This issue was originally opened by @Teja1126 as hashicorp/terraform#27947. It was migrated here as a result of the provider split. The original body of the issue is below.
Hi there,
We have an issue with the terraform script which is working in us-west-1 same script is failing in ap-sotheast-1
Terraform Version
Terraform v0.14.0
Your version of Terraform is out of date! The latest version
is 0.14.7. You can update by downloading from https://www.terraform.io/downloads.html
Terraform Code
locals {
s-1 = "customevm-1"
s-2 = "customevm-2"
n-1 = "customevm-3"
}
data "aws_instances" "s-1" {
filter {
name = "tag:Name"
values = [local.s-1]
}
}
data "aws_instances" "s-2" {
filter {
name = "tag:Name"
values = [local.s-2]
}
}
data "aws_instances" "n-1" {
filter {
name = "tag:Name"
values = [local.n-1]
}
}
resource "local_file" "ec2_instances" {
content = <<EOT
n-1=${data.aws_instances.n-1.ids[0]}
s-1=${data.aws_instances.s-1.ids[0]}
s-2=${data.aws_instances.s-2.ids[0]}
EOT
filename = "../ec2_instances.txt"
}
Terraform Configuration Files
tfvars
access_key="xxxxxxxxxxxxxxx"
secret_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
region="ap-southeast-1"
Debug Output
Crash Output
terraform plan
Error: Your query returned no results. Please change your search criteria and try again.
Error: Your query returned no results. Please change your search criteria and try again.
Error: Your query returned no results. Please change your search criteria and try again.
Same code in other region
Terraform will perform the following actions:
terraform plan
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
Terraform will perform the following actions:
local_file.ec2_instances will be created
s-1=i-05xxxxxxxxxxx46
s-2=i-0axxxxxxxxxxx72
n-1=i-09xxxxxxxxxxx80
EOT
}
Plan: 1 to add, 0 to change, 0 to destroy.
Expected Behavior
terraform plan
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
Terraform will perform the following actions:
local_file.ec2_instances will be created
s-1=i-05xxxxxxxxxxx46
s-2=i-0axxxxxxxxxxx72
n-1=i-09xxxxxxxxxxx80
EOT
}
Plan: 1 to add, 0 to change, 0 to destroy.
Actual Behavior
terraform plan
Error: Your query returned no results. Please change your search criteria and try again.
Error: Your query returned no results. Please change your search criteria and try again.
Error: Your query returned no results. Please change your search criteria and try again.
Steps to Reproduce
Additional Context
References
The text was updated successfully, but these errors were encountered: