terraform {
  required_providers {
    null = {
      source  = "hashicorp/null"
      version = "~> 3.2"
    }
    azurerm = {
      source  = "hashicorp/azurerm"
      version = "~> 4.58"
    }
    random = {
      source  = "hashicorp/random"
      version = "~> 3.6"
    }
  }

  backend "s3" {
    bucket       = "autonomous-deployment-terraform-state"
    region       = "us-west-2"
    use_lockfile = true
  }
}

provider "azurerm" {
  use_cli         = true
  subscription_id = local.controlplane_subscription
  tenant_id       = local.controlplane_tenant_id
  client_id       = local.controlplane_client_id
  features {}
}

data "local_command" "git_rev_parse" {
  command   = "git"
  arguments = ["rev-parse", "HEAD"]
}

output "apply_commit" {
  value = chomp(data.local_command.git_rev_parse.stdout)
}
