简体   繁体   English

尽管是订阅所有者,但无法使用 terraform 创建 azura 资源

[英]Unable to create azura resources using terraform despite being a subscription owner

I cannot create any resource in azure cloud using terraform.我无法使用 terraform 在 azure 云中创建任何资源。

WSL2 - Ubuntu: WSL2-Ubuntu:

             Ubuntu 20.04.3 LTS 

Terraform version: Terraform 版本:

             Terraform v1.1.5

AZ CLI version: AZ CLI 版本:

            "azure-cli": "2.33.0"
            "azure-cli-core": "2.33.0"
            "azure-cli-telemetry": "1.0.6"

At the beggining I login to azure subscription through az login.一开始我通过 az 登录登录到 azure 订阅。 I have only one available subscription on this account and I am owner.我在这个帐户上只有一个可用的订阅并且我是所有者。

Then I create "main.tf" file same as here: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs#example-usage然后我创建与此处相同的“main.tf”文件: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs#example-usage

After "terraform init" i do "terraform plan" but i recive that error:在“terraform init”之后我做了“terraform plan”但是我收到了那个错误:

                     Error: Unable to list provider registration status, it is possible that this is due to invalid credentials or the service principal does not have permission to use the Resource Manager API, Azure error: resources.ProvidersClient#List: Failure sending request: StatusCode=0 -- Original Error: Get "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers?api-version=2016-02-01": dial tcp: lookup management.azure.com on 000.00.000.0:00: cannot unmarshal DNS message

                     with provider["registry.terraform.io/hashicorp/azurerm"],
                     on main.tf line 10, in provider "azurerm":
                     10: provider "azurerm" {

Also i go through this way: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/guides/service_principal_client_secret我也是 go 通过这种方式: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/guides/service_principal_client_secret

My app has contributor/owner priviliges at the subscription level.我的应用程序在订阅级别具有贡献者/所有者权限。

Then adding this configuration:然后添加这个配置:

            provider "azurerm" {
               features {}
               subscription_id = "00000000-0000-0000-0000-000000000000"
               client_id       = "00000000-0000-0000-0000-000000000000"
               client_secret   = var.client_secret
               tenant_id       = "00000000-0000-0000-0000-000000000000"
            }

Finally I get the same error.最后我得到了同样的错误。 Do you have any ideas?你有什么想法?

sudo vim /etc/resolv.conf

and change nameserver value to 8.8.8.8并将nameserver值更改为8.8.8.8

It should work, but every time you reboot you should do this action or write a script to automate it!它应该可以工作,但每次重新启动时都应该执行此操作或编写脚本来自动执行它!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Terraform 按顺序创建资源 - Terraform Create Resources In Order Terraform 使用 for_each 和 jsondecode 创建多个资源 - Terraform create multiple resources using for_each and jsondecode 我想创建一个 devops 管道以使用 Azure 创建我的资源 Terraform - I want to create a devops pipeline to create my resources in Azure using Terraform 无法使用 AWS CDK 创建对 KinesisStream 的订阅过滤器 - Unable to create subscription filter to KinesisStream using AWS CDK 使用我的用户帐户使用 terraform 在 root 帐户中创建 sns 和 cloudwatch 资源 - Using my user account to create sns and cloudwatch resources in root account using terraform 是否可以使用 terraform 创建 GCP 资源而无需每次更改 main.tf & varaible.tf? - Is it possible to create GCP resources using terraform without changing main.tf & varaible.tf everytime? 使用 Terraform 模块导入现有 AWS 资源 - Importing existing AWS Resources using Terraform Module 尽管资源似乎可用,但无法启动新的 pod - Unable to launch new pods despite resources seemingly available 如何使用 Terraform 创建具有不同名称和目标文件的多个资源? - How to create multiple resources with different names and target files with Terraform? 无法创建用于 terraform_remote_state 的动态地形输出 - Unable to create dynamic terraform outputs for use in terraform_remote_state
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM