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

terraform plan or maybe refresh removes outputs from state file #1369

Closed
bitglue opened this issue Apr 2, 2015 · 2 comments · Fixed by #1485
Closed

terraform plan or maybe refresh removes outputs from state file #1369

bitglue opened this issue Apr 2, 2015 · 2 comments · Fixed by #1485
Assignees

Comments

@bitglue
Copy link

bitglue commented Apr 2, 2015

If you have a configuration that uses modules which have outputs, or the root module has outputs of its own, terraform plan will eat them.

diff --git a/state/terraform.tfstate b/state/terraform.tfstate
index 8ce953a..287af53 100644
--- a/state/terraform.tfstate
+++ b/state/terraform.tfstate
@@ -1,17 +1,12 @@
 {
     "version": 1,
-    "serial": 54,
+    "serial": 55,
     "modules": [
         {
             "path": [
                 "root"
             ],
-            "outputs": {
-                "dev_public_ip": "xxx",
-                "dev_vpc_id": "vpc-xxx",
-                "internal_public_ip": "xxx",
-                "internal_vpc_id": "vpc-xxx"
-            },
+            "outputs": {},
             "resources": {}
         },
         {
Stage this hunk [y,n,q,a,d,/,j,J,g,s,e,?]? y
@@ -19,12 +14,7 @@
                 "root",
                 "dev_coreos"
             ],
-            "outputs": {
-                "public_ip": "xxx",
-                "subnet_id_0": "subnet-xxx",
-                "subnet_id_1": "subnet-xxx",
-                "subnet_id_2": "subnet-xxx"
-            },
+            "outputs": {},
             "resources": {
                 "aws_instance.coreos.0": {
                     "type": "aws_instance",

You can also see this by doing:

  • run terraform apply. The root outputs will be printed.
  • run terraform show. Outputs are printed again.
  • run terraform plan. No changes are planned.
  • run terraform show. The outputs are gone.
  • run terraform apply. No changes.
  • run terraform show. The outputs are back.
@pearkes
Copy link
Contributor

pearkes commented Apr 10, 2015

Just a note that I've encountered this too.

@ghost
Copy link

ghost commented May 3, 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 May 3, 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