所以我正在尝试将 Terraform 连接到 Azure Gov,但似乎没有读取代码中的环境。或者我离这个很远,任何帮助都将不胜感激。
这是代码,非常基本的只是试图让它连接并在状态文件中存储一些东西。
terraform {
backend "azurerm" {
#resource_group_name = "terraform-test"
storage_account_name = "terraformstate01"
container_name = "tstate01"
key = "terraform.tfstate"
access_key = "ACCESS_KEY_GOES_HERE"
}
}
# Configure the Azure provider
provider "azurerm" {
# The "feature" block is required for AzureRM provider 2.x.
# If you are using version 1.x, the "features" block is not allowed.
version = "2.76.0"
environment = "usgovernment"
features {}
}
resource "azurerm_resource_group" "state-demo-secure" {
name = "state-demo"
location = "usgovvirginia"
}
这里还附上了我在运行 Terraform init 时遇到的错误。
Initializing the backend...
╷
│ Error: Failed to get existing workspaces: containers.Client#ListBlobs: Failure responding to request: StatusCode=403 -- Original Error: autorest/azure: Service returned an error. Status=403 Code="AuthenticationFailed" Message="Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.\nRequestId:c5022f4e-c01e-0002-51f4-74a3d7000000\nTime:2021-07-09T18:55:41.1228617Z"```