How to Terraform import azurerm_postgresql_active_directory_administrator for a postgresql flexible server on Azure

huangapple go评论82阅读模式
英文:

How to Terraform import azurerm_postgresql_active_directory_administrator for a postgresql flexible server on Azure

问题

我手动在Azure上创建了一个PostgreSQL的灵活服务器,因为通过Terraform创建时出现了错误。在创建灵活服务器时,有一个选项可以选择AAD服务器管理员:

在创建整个资源后,我试图将其导入到Terraform中。
为了指定AAD服务器管理员,我尝试使用以下资源:"azurerm_postgresql_active_directory_administrator"。对于该资源,文档中提供的导入命令是:

terraform import azurerm_postgresql_active_directory_administrator.administrator /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourcegroup/providers/Microsoft.DBforPostgreSQL/servers/myserver

我的问题是,是否有替代方法?这个"azurerm_postgresql_active_directory_administrator.administrator"资源是否可以用于灵活服务器?是否需要使用它?

我尝试使用我的灵活服务器资源ID,但是出现了以下错误:

期望与服务器ID匹配:
│ 
│ > /subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.DBforPostgreSQL/servers/serverValue
│ 
│ 但提供了以下值:
│ 
│ > /subscriptions/<my__sensitive_subscription_id>/resourceGroups/hrpap-dev-db-postgres-rg/providers/Microsoft.DBforPostgreSQL/flexibleServers/hrpap-dev-db-postgres-database-flex/administrators/<object_id>
│ 
│ 解析的资源ID在位置6处的段缺少一个值(应该是文字值"servers")。

如果还有其他需要翻译的内容,请提供。

英文:

I created a PostgreSQL flexible server on Azure manually, since there is an error creating it through Terraform. When creating the flexible server, there is an option to select AAD Server admin:

How to Terraform import azurerm_postgresql_active_directory_administrator for a postgresql flexible server on Azure

After creating the whole resource, I am trying to import it into Terraform.
For specifying the AAD Server admin, I tried using the following resource: "azurerm_postgresql_active_directory_administrator". For that resource, the import command that is available inside the documentation would be:
terraform import azurerm_postgresql_active_directory_administrator.administrator /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourcegroup/providers/Microsoft.DBforPostgreSQL/servers/myserver

My question is, is there an alternative for this, can this "azurerm_postgresql_active_directory_administrator.administrator" resource even be used for flexible servers? Does it need to be used?

I tried using my flexible servers resource ID, but I get the following error:

Expected a Server ID that matched:

│ &gt; /subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.DBforPostgreSQL/servers/serverValue

│ However this value was provided:

│ &gt; /subscriptions/&lt;my__sensitive_subscription_id&gt;/resourceGroups/hrpap-dev-db-postgres-rg/providers/Microsoft.DBforPostgreSQL/flexibleServers/hrpap-dev-db-postgres-database-flex/administrators/&lt;object_id&gt;

│ The parsed Resource ID was missing a value for the segment at position 6
│ (which should be the literal value &quot;servers&quot;).

答案1

得分: 0

有一个新的资源可用,需要稍微不同的配置:

https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/postgresql_flexible_server_active_directory_administrator

英文:

Apparently, there is a new resource for that, with a little bit different configuration required:

https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/postgresql_flexible_server_active_directory_administrator

huangapple
  • 本文由 发表于 2023年5月17日 17:59:59
  • 转载请务必保留本文链接:https://go.coder-hub.com/76270852.html
  • azure
  • azure-active-directory
  • postgresql
  • terraform
  • terraform-provider-azure
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定