Not sure I am implementing this correctly but assumed it would work pretty much like resource remote state. But when i update the syntax to use the new data source functionality, none of the outputs are being pulled in.
I have two terraform states vpc and subnet. Vpc is set up with a remote config of s3. Subnet is referencing that remote state to get one of its outputs (vpc_id).
Here is my vpc tf file:
resource "aws_vpc" "vpc" {
enable_dns_support = true
enable_dns_hostnames = true
tags { Name = "test-vpc-v7" }
lifecycle { create_before_destroy = true }
output "vpc_cidr" { value = "${aws_vpc.vpc.cidr_block}" }
I set up the remote config as such
terraform remote config -backend=s3 -backend-config="bucket=wm-tfstate" -backend-config="key=terraform-v7-test-vpc.tfstate" -backend-config="region=us-east-1"
I run the apply and vpc is created, remote tfstate file exists.
data "terraform_remote_state" "vpc" {
key = "terraform-v7-test-vpc.tfstate"
resource "aws_subnet" "public" {
availability_zone = "us-west-2a"
map_public_ip_on_launch = true
Name = "test-subnet-us-west-2a"
When I do a terraform show, it does not list any of the outputs from above. Obviously when I do an apply it fails. Here is the output from show:
data.terraform_remote_state.vpc:
id = 2016-06-01 14:57:13.738455992 +0000 UTC
config.bucket = wm-tfstate
config.key = terraform-v7-test-vpc.tfstate
config.region = us-east-1
I have tested other providers like the aws one to call "data "aws_availability_zones" "zones" {}" and it will resolve those. The remote state one does not seem to work. Before I file a bug just wanted to make sure I was attempting to implement this correctly.
Thanks,
Chris