Created
April 15, 2015 21:26
-
-
Save phinze/ff910e3a411a67062a75 to your computer and use it in GitHub Desktop.
Terraform: Double checking state flags
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
variable "region" { } | |
provider "aws" { | |
region = "${var.region}" | |
} | |
module "ami" { | |
source = "github.com/terraform-community-modules/tf_aws_ubuntu_ami/ebs" | |
region = "${var.region}" | |
distribution = "trusty" | |
instance_type = "m1.small" | |
} | |
resource "aws_instance" "web" { | |
ami = "${module.ami.ami_id}" | |
instance_type = "m1.small" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~/issues/github.com/hashicorp/terraform/irc-double-check-state-flags | |
❯ terraform apply -var region=us-east-1 -state=east.tfstate | |
aws_instance.web: Creating... | |
ami: "" => "ami-fc5e7594" | |
availability_zone: "" => "<computed>" | |
ebs_block_device.#: "" => "<computed>" | |
ephemeral_block_device.#: "" => "<computed>" | |
instance_type: "" => "m1.small" | |
key_name: "" => "<computed>" | |
private_dns: "" => "<computed>" | |
private_ip: "" => "<computed>" | |
public_dns: "" => "<computed>" | |
public_ip: "" => "<computed>" | |
root_block_device.#: "" => "<computed>" | |
security_groups.#: "" => "<computed>" | |
subnet_id: "" => "<computed>" | |
tenancy: "" => "<computed>" | |
aws_instance.web: Creation complete | |
Apply complete! Resources: 1 added, 0 changed, 0 destroyed. | |
The state of your infrastructure has been saved to the path | |
below. This state is required to modify and destroy your | |
infrastructure, so keep it safe. To inspect the complete state | |
use the `terraform show` command. | |
State path: east.tfstate | |
~/issues/github.com/hashicorp/terraform/irc-double-check-state-flags | |
❯ terraform apply -var region=us-west-2 -state=west.tfstate | |
aws_instance.web: Creating... | |
ami: "" => "ami-7f89a64f" | |
availability_zone: "" => "<computed>" | |
ebs_block_device.#: "" => "<computed>" | |
ephemeral_block_device.#: "" => "<computed>" | |
instance_type: "" => "m1.small" | |
key_name: "" => "<computed>" | |
private_dns: "" => "<computed>" | |
private_ip: "" => "<computed>" | |
public_dns: "" => "<computed>" | |
public_ip: "" => "<computed>" | |
root_block_device.#: "" => "<computed>" | |
security_groups.#: "" => "<computed>" | |
subnet_id: "" => "<computed>" | |
tenancy: "" => "<computed>" | |
aws_instance.web: Creation complete | |
Apply complete! Resources: 1 added, 0 changed, 0 destroyed. | |
The state of your infrastructure has been saved to the path | |
below. This state is required to modify and destroy your | |
infrastructure, so keep it safe. To inspect the complete state | |
use the `terraform show` command. | |
State path: west.tfstate | |
~/issues/github.com/hashicorp/terraform/irc-double-check-state-flags | |
❯ terraform apply -var region=us-east-1 -state=east.tfstate | |
aws_instance.web: Refreshing state... (ID: i-f491d008) | |
Apply complete! Resources: 0 added, 0 changed, 0 destroyed. | |
~/issues/github.com/hashicorp/terraform/irc-double-check-state-flags | |
❯ ls | |
east.tfstate main.tf west.tfstate.backup | |
east.tfstate.backup west.tfstate | |
~/issues/github.com/hashicorp/terraform/irc-double-check-state-flags | |
❯ terraform apply -var region=us-east-1 -state=east.tfstate | |
aws_instance.web: Refreshing state... (ID: i-f491d008) | |
Apply complete! Resources: 0 added, 0 changed, 0 destroyed. | |
~/issues/github.com/hashicorp/terraform/irc-double-check-state-flags | |
❯ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment