Difference between revisions of "Terraform data source: terraform remote state"
Jump to navigation
Jump to search
Tags: Mobile web edit, Mobile edit |
Tags: Mobile web edit, Mobile edit |
||
Line 1: | Line 1: | ||
<code>terraform_remote_state</code> | <code>terraform_remote_state</code> | ||
− | + | * https://developer.hashicorp.com/terraform/language/state/remote-state-data | |
− | https://developer.hashicorp.com/terraform/language/state/remote-state-data | ||
* <code>[[Controlled Remote State Access]] feature in [[Terraform Cloud]] and Terraform Enterprise, users now have a new way to establish granular controls for state accessibility.</code> | * <code>[[Controlled Remote State Access]] feature in [[Terraform Cloud]] and Terraform Enterprise, users now have a new way to establish granular controls for state accessibility.</code> |
Revision as of 15:44, 15 March 2023
terraform_remote_state
Controlled Remote State Access feature in Terraform Cloud and Terraform Enterprise, users now have a new way to establish granular controls for state accessibility.
Contents
Example Usage (remote Backend)
data "terraform_remote_state" "vpc" { backend = "remote" config = { organization = "hashicorp" workspaces = { name = "vpc-prod" } } } # Terraform >= 0.12 resource "aws_instance" "foo" { # ... subnet_id = data.terraform_remote_state.vpc.outputs.subnet_id } # Terraform <= 0.11 resource "aws_instance" "foo" { # ... subnet_id = "${data.terraform_remote_state.vpc.subnet_id}" }
Example Usage (local Backend)
data "terraform_remote_state" "vpc" { backend = "local" config = { path = "..." } } # Terraform >= 0.12 resource "aws_instance" "foo" { # ... subnet_id = data.terraform_remote_state.vpc.outputs.subnet_id } # Terraform <= 0.11 resource "aws_instance" "foo" { # ... subnet_id = "${data.terraform_remote_state.vpc.subnet_id}" }
Errors
Related
See also
- Terraform state:
terraform [ state | replace-provider | mv ]
,backend.tf
, Remote state backends to manage Terraform state, State locking,terraform force-unlock
- Terraform data sources:
aws_vpc
,template_file
,aws_subnet_ids
,terraform remote state
,aws_eks_cluster
,aws_ami, aws_availability_zones, aws_partition, archive_file
- Terraform state:
terraform [ state | replace-provider | mv ]
,backend.tf
, Remote state backends to manage Terraform state, State locking,terraform force-unlock
Advertising: