• HashiCorp Developer

  • HashiCorp Cloud Platform
  • Terraform
  • Packer
  • Consul
  • Vault
  • Boundary
  • Nomad
  • Waypoint
  • Vagrant
Terraform
  • Install
  • Tutorials
    • About the Docs
    • Configuration Language
    • Terraform CLI
    • Terraform Cloud
    • Terraform Enterprise
    • CDK for Terraform
    • Provider Use
    • Plugin Development
    • Registry Publishing
    • Integration Program
  • Registry(opens in new tab)
  • Try Cloud(opens in new tab)
  • Sign up
Terraform Home

Tutorials

Skip to main contentTutorials

Get Started

  • AWS
  • Azure
  • Docker
  • GCP
  • OCI
  • Terraform Cloud

Fundamentals

  • CLI
  • Configuration Language
  • Modules
  • Provision
  • State
  • Terraform Cloud

Use Cases

  • Applications
  • AWS Services
  • Azure Services
  • HashiCorp Products
  • IT/SaaS Providers
  • Kubernetes
  • Machine Images
  • Networking
  • Policy
  • Security

Certification Prep

  • Associate Prep (002)
  • Associate Prep (003)
  • Associate Tutorials (002)
  • Associate Tutorials (003)

Production

  • Automate Terraform
  • Enterprise Patterns
  • Terraform Enterprise

Integrations

  • CDK for Terraform
  • Community Providers
  • Custom Framework Providers
  • Custom SDK Providers
  • Secrets

  • Resources

  • Tutorial Library
  • Certifications
  • Community Forum
    (opens in new tab)
  • Support
    (opens in new tab)
  • GitHub
    (opens in new tab)
  • Terraform Registry
    (opens in new tab)
  1. Developer
  2. Terraform
  3. Tutorials
  4. State

Manage Terraform State

Manage Terraform state. Follow these tutorials to import existing infrastructure and manipulate state storage.

Start
11 tutorials
  •  
    25min
    Import Terraform Configuration
    Import existing infrastructure into Terraform. In this tutorial, you will use Terraform import to manage an existing Docker container and learn important considerations to keep in mind when importing infrastructure into Terraform.
    • Terraform
  •  
    9min
    Migrate State to Terraform Cloud
    Migrate a state file to Terraform Cloud for secure storage and easy collaboration.
    • Terraform
  •  
    19min
    Manage Resources in Terraform State
    Create an EC2 instance and security group, and move a resource to another state file. Remove, replace, and re-import resources to manage state and reconcile drift in your infrastructure.
    • Terraform
  •  
    20min
    Target Resources
    Apply changes to an AWS S3 bucket and bucket objects using resource targeting. Target individual resources, modules, and collections of resources to change or destroy. Explore how Terraform handles upstream and downstream dependencies.
    • Terraform
  •  
    15min
    Troubleshoot Terraform
    Interpret and fix a Terraform configuration with common configuration language errors and deploy an EC2 instance with security groups in AWS. Learn best practices for logging application errors and reporting bugs.
    • Terraform
  •  
    12min
    Manage Resource Drift
    Create an AWS instance and security group. Manually change the instance to create drift in your Terraform state file. Reconcile your state drift and import your resources while avoiding downtime.
    • Terraform
  •  
    8min
    Manage Resource Lifecycle
    Create an AWS instance and security group. Update your configuration with lifecycle management blocks to prevent resource deletion, create resources before destroying them, and ignore changes to specific resource attributes.
    • Terraform
  •  
    13min
    Version Remote State with the Terraform Cloud API
    Deploy an EC2 instance to a Terraform Cloud workspace and use the Terraform API to interact with and update state.
    • Terraform
  •  
    9min
    Use Refresh-Only Mode to Sync Terraform State
    Use refresh-only plans and applies to update Terraform state to match real-world infrastructure. Understand the implicit refresh behavior in Terraform plan and apply operations.
    • Terraform
  •  
    12min
    Develop Configuration with the Console
    Use the Terraform console to inspect resources and evaluate Terraform expressions before using them in configurations. Configure an S3 bucket with an IAM role to restrict access by IP address.
    • Terraform
  •  
    14min
    Use Configuration to Move Resources
    Use the configuration-driven workflow to change Terraform resource IDs. Refactor configuration to move resources into modules using the `moved` block.
    • Terraform
Give Feedback(opens in new tab)
  • Certifications
  • System Status
  • Terms of Use
  • Security
  • Privacy
  • Trademark Policy
  • Trade Controls
  • Give Feedback(opens in new tab)