Difference between revisions of "Terraform plan"

From wikieduonline
Jump to navigation Jump to search
 
(75 intermediate revisions by 6 users not shown)
Line 1: Line 1:
* https://www.terraform.io/docs/cli/commands/plan.html
+
{{lowercase}}
 +
<code>[[terraform]] plan</code> ([https://www.terraform.io/docs/cli/commands/plan.html doc]) creates an [[execution plan]].
  
== Examples ==
+
{{terraform flow}}
  
 +
== Command examples ==
 +
* <code>[[terraform plan --help]]</code>
 +
* <code>[[-no-color]]</code>
 +
* <code>terraform plan [[-out]]=tfplan.out</code>
 +
* <code>terraform plan [[-out]]=[[tfplan]]</code>
 +
* <code>[[terraform plan -lock=false]]</code>
 +
* <code>terraform plan [[-var-file]]="your_file.tfvars"</code>
 +
* <code>[[terraform]] plan -var=XXXX</code>
 +
* <code>terraform plan [[-replace]]=XXXX</code>
 +
* <code>[[terraform plan -target]]</code>
 +
* <code>[[terraform plan -refresh-only]]</code>
 +
* <code>[[terraform plan -parallelism]]</code>
 +
* <code>terraform plan | [[more -R]]</code>
  
 +
https://www.terraform.io/cli/commands/plan#planning-options
 +
-refresh=false
 +
-replace=ADDRESS
 +
[[terraform plan -target]]=ADDRESS
  
=== Error: undeclared resource ===
 
  terraform plan
 
 
│ Error: Reference to undeclared resource
 
 
│  on main.tf line 9, in resource "aws_instance" "example":
 
│    9:  [[ami]]              = data.aws_ami.windows.id
 
 
│ A data resource "aws_ami" "windows" has not been declared in the root module.
 
 
  
  terraform plan
+
  tf plan 2>&1
Refreshing Terraform state in-memory prior to plan...
 
The refreshed state will be used to calculate this plan, but will not be
 
persisted to local or remote state storage.
 
------------------------------------------------------------------------
 
No changes. Infrastructure is up-to-date.
 
 
This means that Terraform did not detect any differences between your
 
configuration and real physical resources that exist. As a result, no
 
actions need to be performed.
 
  
 +
== Execution examples ==
 +
* [[Examples: terraform plan]]
 +
* [[Terraform plan execution with errors]]
  
terraform plan
+
== Errors ==
+
* <code>[[Error: Reference to undeclared input variable]]</code>
Error: No configuration files
+
 
+
 
  Plan requires configuration to be present. Planning without a configuration
+
  2024-07-03T13:44:35.311Z [WARN] Provider "[[registry.terraform.io]]/datadog/datadog" produced an invalid plan for datadog_user.yourusers["yourusername"], but we are tolerating it because it is using the [[legacy plugin SDK]].
  would mark everything for destruction, which is normally not what is desired.
+
    The following problems may be the cause of any confusing errors from downstream operations:
If you would like to destroy everything, run plan with the -destroy option.
+
      - .send_user_invitation: planned value cty.True for a non-computed ...
Otherwise, create a Terraform configuration file (.tf file) and try again.
 
  
 
== Related terms ==
 
== Related terms ==
* [[Terraform: Hello_world.tf]]
+
* [[Terraform examples]]: [[Terraform: Hello_world.tf]]
 
* [[GitLab]] Preview of summary of <code>terraform plan</code> in [[Merge Requests]] https://about.gitlab.com/releases/2020/05/22/gitlab-13-0-released/#review-summary-of-terraform-plan-in-merge-requests
 
* [[GitLab]] Preview of summary of <code>terraform plan</code> in [[Merge Requests]] https://about.gitlab.com/releases/2020/05/22/gitlab-13-0-released/#review-summary-of-terraform-plan-in-merge-requests
* <code>[[terraform validate]]</code>
+
* <code>[[terraform validate]], [[terraform apply]], [[terraform show]]</code>
 +
* <code>[[aws cloudformation list-change-sets]]</code>
 +
* <code>[[aws cloudformation describe-change-set]]</code>
 +
* <code>[[terragrunt plan]]</code>
 +
* <code>[[terraform debug]]</code>
 +
* <code>[[export TF_LOG=DEBUG]]</code>
 +
* [[ReferenceTransformer]]
 +
* <code>[[Plan: 0 to add, 0 to change, 0 to destroy.]]</code>
 +
* <code>[[terraform test]]</code>
  
 
== See also ==
 
== See also ==
* {{terraform cmd}}
+
* {{terraform plan}}
* {{terraform}}
 
  
 
[[Category:Terraform]]
 
[[Category:Terraform]]

Latest revision as of 13:56, 3 July 2024

terraform plan (doc) creates an execution plan.

 terraform init -> terraform plan ->  terraform apply -> terraform show

Command examples[edit]

https://www.terraform.io/cli/commands/plan#planning-options

-refresh=false
-replace=ADDRESS
terraform plan -target=ADDRESS


tf plan 2>&1

Execution examples[edit]

Errors[edit]


2024-07-03T13:44:35.311Z [WARN]  Provider "registry.terraform.io/datadog/datadog" produced an invalid plan for datadog_user.yourusers["yourusername"], but we are tolerating it because it is using the legacy plugin SDK.
   The following problems may be the cause of any confusing errors from downstream operations:
     - .send_user_invitation: planned value cty.True for a non-computed ...

Related terms[edit]

See also[edit]

Advertising: