Find the Best Cosmetic Hospitals

Explore trusted cosmetic hospitals and make a confident choice for your transformation.

“Invest in yourself — your confidence is always worth it.”

Explore Cosmetic Hospitals

Start your journey today — compare options in one place.

Terraform: Step‑By‑Step: Use Local CLI to Modify Remote State in TFE

Below is a step‑by‑step tutorial for using the Terraform CLI against a VCS‑connected HCP/TFE workspace, plus a command catalog for all the common remote actions.

Step‑By‑Step: Use Local CLI to Modify Remote State in TFE

  1. Verify your Terraform version matches the workspace requirement
   terraform version

If the workspace requires ~>1.14.0, make sure you’re on 1.14.x.

  1. Authenticate to HCP/TFE
   terraform login
  1. Set the remote workspace (pick one method) Option A: Use env vars (fast + explicit)
   export TF_CLOUD_ORGANIZATION="Drivemode"
   export TF_WORKSPACE="evp-aws-development-core"Code language: JavaScript (javascript)

Option B: Use workspace selection after init

   terraform init
   terraform workspace list
   terraform workspace select evp-aws-development-coreCode language: PHP (php)
  1. Initialize the backend
   terraform init
  1. Confirm the remote state is reachable
   terraform state listCode language: PHP (php)
  1. Modify remote state (example: untaint)
   terraform untaint 'module.k8s_az_anchor[0].kubernetes_manifest.priority_class[0]'Code language: JavaScript (javascript)
  1. Verify the plan is now clean
   terraform plan

That flow modifies the remote state in TFE because your backend is remote and the CLI is authenticated.

Remote Run Commands (All Common Commands That Run Remote Actions)

These commands create or change remote resources (or interact with remote state):

  1. Plan (remote run)
   terraform plan
  1. Apply (remote run)
   terraform apply
  1. Destroy (remote run)
   terraform destroy

Alternative:

   terraform apply -destroy
  1. Import (writes to remote state)
   terraform import <resource_address> <remote_id>Code language: HTML, XML (xml)
  1. Refresh only (safe read/update of state)
   terraform plan -refresh-only
  1. State list (remote state)
   terraform state listCode language: PHP (php)
  1. State show (remote state)
   terraform state show <resource_address>Code language: HTML, XML (xml)
  1. State move (remote state)
   terraform state mv <old_address> <new_address>Code language: HTML, XML (xml)
  1. State remove (remote state)
   terraform state rm <resource_address>Code language: HTML, XML (xml)
  1. State pull (remote → local file) terraform state pull > /tmp/tfstate.json
  2. State push (local file → remote) terraform state push /tmp/tfstate.json
  3. Replace provider in state (remote state) terraform state replace-provider <old_provider> <new_provider>
  4. Taint / Untaint (if supported by your version) terraform taint <resource_address> terraform untaint <resource_address>
  5. Force unlock remote state (rare) terraform force-unlock <LOCK_ID>
  6. Show outputs (remote state)
    bash terraform output

Important behavior in VCS‑connected workspaces

  • CLI runs use your local config snapshot, not the Git branch snapshot.
  • If CLI‑driven runs are disabled in the workspace, plan/apply/import will fail.
  • State commands still work if your org policy allows and your version matches.

If you want, I can tailor this to your exact workspace settings. Which one is your workspace using?

  1. VCS‑connected + CLI runs allowed
  2. VCS‑connected + CLI runs disabled
  3. CLI‑driven workspace (no VCS)

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services — all in one place.

Explore Hospitals
I’m a DevOps/SRE/DevSecOps/Cloud Expert passionate about sharing knowledge and experiences. I have worked at <a href="https://www.cotocus.com/">Cotocus</a>. I share tech blog at <a href="https://www.devopsschool.com/">DevOps School</a>, travel stories at <a href="https://www.holidaylandmark.com/">Holiday Landmark</a>, stock market tips at <a href="https://www.stocksmantra.in/">Stocks Mantra</a>, health and fitness guidance at <a href="https://www.mymedicplus.com/">My Medic Plus</a>, product reviews at <a href="https://www.truereviewnow.com/">TrueReviewNow</a> , and SEO strategies at <a href="https://www.wizbrand.com/">Wizbrand.</a> Do you want to learn <a href="https://www.quantumuting.com/">Quantum Computing</a>? <strong>Please find my social handles as below;</strong> <a href="https://www.rajeshkumar.xyz/">Rajesh Kumar Personal Website</a> <a href="https://www.youtube.com/TheDevOpsSchool">Rajesh Kumar at YOUTUBE</a> <a href="https://www.instagram.com/rajeshkumarin">Rajesh Kumar at INSTAGRAM</a> <a href="https://x.com/RajeshKumarIn">Rajesh Kumar at X</a> <a href="https://www.facebook.com/RajeshKumarLog">Rajesh Kumar at FACEBOOK</a> <a href="https://www.linkedin.com/in/rajeshkumarin/">Rajesh Kumar at LINKEDIN</a> <a href="https://www.wizbrand.com/rajeshkumar">Rajesh Kumar at WIZBRAND</a> <a href="https://www.rajeshkumar.xyz/dailylogs">Rajesh Kumar DailyLogs</a>

Related Posts

How to Connect a WordPress Website Using an FTP Client?

Introduction -H2 Sometimes, during installing plugins or custom themes, people face issues of WordPress website breakdown. This happens due to the WordPress dashboard not accepting the new…

Read More

The Evolution of DevOps: Bridging the Gap Between Development and Operations

The Origins of DevOps The concept of DevOps emerged as a response to the traditional separation between software development and IT operations. Historically, these two disciplines operated…

Read More

B2B Gifting for DevOps and Engineering Teams: What Actually Works

Employee and client recognition is an established part of business culture, but for DevOps and engineering teams, the standard corporate gifting playbook rarely lands well. A generic…

Read More

How DevOps Teams Automate Ticket Creation from Monitoring and Backup Systems

There are 5,000 alerts generated every day in the average enterprise DevOps environment. But most of these alerts never reach a human until a system fails completely….

Read More

Best EHR Software Development Companies in the USA for FHIR, HIPAA, and Beyond

An EHR system is not a typical software project. It sits at the intersection of clinical workflow, compliance, interoperability, and patient safety, and any one of these…

Read More

Why Healthcare AI Depends on Expert Data Annotation Companies

                                                       Photo by Accuray on Unsplash  Healthcare AI doesn’t work without reliable labeled data. Every diagnostic model, triage tool, or clinical assistant needs structured examples to learn from….

Read More
Subscribe
Notify of
guest
1 Comment
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
Jason Mitchell
Jason Mitchell
1 month ago

Good article! It explains how to use the Terraform CLI to modify remote state in Terraform Enterprise step by step. Very helpful for anyone working with Terraform and remote state management.

1
0
Would love your thoughts, please comment.x
()
x