diigo.to.shak.blogspot.dailiy. 03/26/2024

    • Note that even when TF_LOG_PATH is set, TF_LOG must be set in order for any logging to be enabled.
      • For all terraform commands that involves states, e.g., plan, apply, refresh (deprecated and is now '-refresh-only'), it is useful to think about it in terms of 2 things:

         
           
        • The authoritative state
        •  
        • The states being compared Note that the 'authoritative state' is NEVER changed as a result of the command.
        •  
         

        There are 3 types of 'state' (loosely):

         
           
        • Actual state of your infra (actual-state)
        •  
        • terraform state file (tf-state-file)
        •  
        • State described by terraform code config (tf-dsl-config)
        •  
         

        When you do terraform plan/apply WITH -refresh-only:

         
           
        • The authoritative state is 'actual-state'
        •  
        • The states being compared in 'terraform plan -refresh-only' is 'actual-state' vs. 'tf-state-file'
        •  
        • The outcome of 'terraform apply -refresh-only' is 'tf-state-file' is synced to become 'actual-state'
        •  
         

        When you do terraform plan/apply WITHOUT -refresh-only:

         
           
        • The authoritative state is 'tf-dsl-config'
        •  
        • The states being compared in 'terraform plan' is 'tf-dsl-config' vs. 'actual-state'
        •  
        • The outcome of 'terraform apply' is 'actual-state' is synced to become 'tf-dsl-config'
        •  
         

        For more details of what authoritative states are, and what states are being compared for various terraform commands see:

Posted from Diigo. The rest of my favorite links are here.

No comments: