TFC remote backend still creates local resources

Hi all,

I’ve been trying to use TFC in order to store the state remotely and get rid of local modules, files and runs on my team’s laptops. I’ve configured the TFC backend (after creating an account, organisation and workspace, of course):

terraform {
  backend "remote" {
    organization = "my_org"

    workspaces {
      name = "my_workspace"
    }
  }
}

I’ve followed the TFC instructions, generated credentials for TFC and created a local file at $HOME/.terraformrc :

credentials "app.terraform.io" {
  token = "#############################################"
}

My Terraform file is the simplest Azure environment:

provider "azurerm" {
  version = ">=1.38.0"
  alias           = "alias"
  subscription_id = "#########################"
}

resource "azurerm_resource_group" "test_resource_group" {
  location = "westeurope"
  name     = "test_resource_group"
}

I was thinking that when I’ll run terraform plan or terraform apply it’ll link me to TFC which will run those commands. To my surprise, I saw azurerm plugin being downloaded to my laptop and Terraform state created locally.

What am I doing wrong here?

Terraform Cloud will store your remote state. You still need to initialize Terraform locally as usual, and it’ll work with the remote state. Do you see a terraform.tfstate file anywhere?

Hello,

Thanks for the reply. I don’t quite understand - in all of the webinars and guides I’ve seen it was mentioned that when you run apply or plan it actually runs in TFC and not in your local machine (which is what’s set in the settings in TFC - remote run instead of local).

Is that incorrect?

I think that’s correct. I was thinking about the remote state feature only.

It looks like it still initializes locally but I’m not sure if that’s necessary, sorry.

Do you see the output mentioning something like “Running plan in the remote backend. Output will stream here”?