Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azurerm_postgresql_active_directory_administrator: "string is required" when upgrading from AzureRM 3.14 to 3.15 #17727

Closed
1 task done
9numbernine9 opened this issue Jul 22, 2022 · 7 comments · Fixed by #17732

Comments

@9numbernine9
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

1.2.5

AzureRM Provider Version

3.15

Affected Resource(s)/Data Source(s)

azurerm_postgresql_active_directory_administrator

Terraform Configuration Files

terraform {
  required_providers {
    azurerm = {
      source  = "hashicorp/azurerm"
      version = "3.15.0"
    }
  }
}

provider "azurerm" {
  features {}
}

data "azurerm_client_config" "current" {}

resource "azurerm_resource_group" "example" {
  name     = "azurerm-debug"
  location = "canadaeast"
}

resource "azurerm_postgresql_server" "example" {
  name                         = "azurerm-debug-psqlserver"
  resource_group_name          = azurerm_resource_group.example.name
  location                     = azurerm_resource_group.example.location
  version                      = "11"
  administrator_login          = "administratorexample"
  administrator_login_password = "thisisaterriblepassworddontuseit12345!"
  sku_name                     = "GP_Gen5_2"
  ssl_enforcement_enabled      = true
}

resource "azurerm_postgresql_active_directory_administrator" "example" {
  server_name         = azurerm_postgresql_server.example.name
  resource_group_name = azurerm_resource_group.example.name

  login               = "sqladmin"
  tenant_id           = data.azurerm_client_config.current.tenant_id
  object_id           = data.azurerm_client_config.current.object_id
}

Debug Output/Panic Output

https://gist.github.com/9numbernine9/bd59bd2fb995cb5d8c1f85f01dee16b6

Expected Behaviour

Terraform will plan and/or apply successfully.

Actual Behaviour

The following error is generated:

╷
│ Error: string is required
│ 
│   with azurerm_postgresql_active_directory_administrator.example,
│   on main.tf line 32, in resource "azurerm_postgresql_active_directory_administrator" "example":
│   32: resource "azurerm_postgresql_active_directory_administrator" "example" {
│ 
╵

Steps to Reproduce

  1. Change the Terraform configuration in this issue to use AzureRM 3.14.
  2. terraform init -upgrade
  3. terraform apply - this should work fine.
  4. Switch to AzureRM 3.15
  5. terraform init -upgrade
  6. terraform plan - Error message received.

Important Factoids

This only occurs when upgrading a resource that was previously created with AzureRM 3.14 (possibly earlier versions as well). This error will not occur if the resource is created from scratch using AzureRM 3.15.

References

No response

@github-actions github-actions bot removed the bug label Jul 22, 2022
@md2k
Copy link

md2k commented Jul 22, 2022

Have same problem. Snip from Trace:

2022-07-22T17:03:27.914+0200 [ERROR] plugin.terraform-provider-azurerm_v3.15.0_x5: Response contains error diagnostic: diagnostic_severity=ERROR diagnostic_summary="string is required" tf_provider_addr=provider @caller=github.com/hashicorp/terraform-plugin-go@v0.10.0/tfprotov5/internal/diag/diagnostics.go:56 tf_resource_type=azurerm_postgresql_active_directory_administrator diagnostic_attribute=AttributeName("id") tf_proto_version=5.2 tf_req_id=XXX-XXXX-XXXX-XXXXX tf_rpc=UpgradeResourceState @module=sdk.proto diagnostic_detail= timestamp=2022-07-22T17:03:27.914+0200

@favoretti
Copy link
Collaborator

Hi there and thank you for reporting this issue. Seems related to:

2022-07-22T09:21:45.124-0400 [DEBUG] provider.terraform-provider-azurerm_v3.15.0_x5: Updating ID from "/subscriptions/650efc9f-033a-46a5-8e1a-294c9be627d2/resourceGroups/azurerm-debug/providers/Microsoft.DBforPostgreSQL/servers/azurerm-debug-psqlserver/administrators/activeDirectory" to "Server (Subscription: \"650efc9f-033a-46a5-8e1a-294c9be627d2\"\nResource Group Name: \"azurerm-debug\"\nServer Name: \"azurerm-debug-psqlserver\")": timestamp=2022-07-22T09:21:45.123-0400

I'll try to have a look today.

@favoretti
Copy link
Collaborator

Got a potential fix, testing.

favoretti added a commit to favoretti/terraform-provider-azurerm that referenced this issue Jul 23, 2022
Fixes hashicorp#17727

With 3.14 to 3.15 with OP testcase:
```
[9:46](⎈ |eastus2-fxs-atlas-nonprod-fxc:ingress-controller)➜  terraform-tests/psql git:(kusto) ✗ $ tp
data.azurerm_client_config.current: Reading...
azurerm_resource_group.example: Refreshing state... [id=/subscriptions/442736d8-39d9-418c-9c0c-2cee7f5126a5/resourceGroups/azurerm-debug]
data.azurerm_client_config.current: Read complete after 0s [id=2022-07-23 07:47:07.200831 +0000 UTC]
azurerm_postgresql_server.example: Refreshing state... [id=/subscriptions/442736d8-39d9-418c-9c0c-2cee7f5126a5/resourceGroups/azurerm-debug/providers/Microsoft.DBforPostgreSQL/servers/azurerm-debug-psqlserver]
╷
│ Error: string is required
│
│   with azurerm_postgresql_active_directory_administrator.example,
│   on main.tf line 32, in resource "azurerm_postgresql_active_directory_administrator" "example":
│   32: resource "azurerm_postgresql_active_directory_administrator" "example" {
│
╵
```
With 3.14 to my branch:
```
[9:47](⎈ |eastus2-fxs-atlas-nonprod-fxc:ingress-controller)➜  terraform-tests/psql git:(kusto) ✗ $ tfdev
[9:47](⎈ |eastus2-fxs-atlas-nonprod-fxc:ingress-controller)➜  terraform-tests/psql git:(kusto) ✗ $ tp
╷
│ Warning: Provider development overrides are in effect
│
│ The following provider development overrides are set in the CLI configuration:
│  - hashicorp/azurerm in /Users/vlazarenko/go/bin
│  - hashicorp/kubernetes in /Users/vlazarenko/go/bin
│  - favoretti/adx in /Users/vlazarenko/go/bin
│
│ The behavior may therefore not match any released version of the provider and applying changes may cause the state to become incompatible with published releases.
╵
azurerm_resource_group.example: Refreshing state... [id=/subscriptions/442736d8-39d9-418c-9c0c-2cee7f5126a5/resourceGroups/azurerm-debug]
data.azurerm_client_config.current: Reading...
data.azurerm_client_config.current: Read complete after 0s [id=2022-07-23 07:48:31.214973 +0000 UTC]
azurerm_postgresql_server.example: Refreshing state... [id=/subscriptions/442736d8-39d9-418c-9c0c-2cee7f5126a5/resourceGroups/azurerm-debug/providers/Microsoft.DBforPostgreSQL/servers/azurerm-debug-psqlserver]
azurerm_postgresql_active_directory_administrator.example: Refreshing state... [id=/subscriptions/442736d8-39d9-418c-9c0c-2cee7f5126a5/resourceGroups/azurerm-debug/providers/Microsoft.DBforPostgreSQL/servers/azurerm-debug-psqlserver]

No changes. Your infrastructure matches the configuration.

Terraform has compared your real infrastructure against your configuration and found no differences, so no changes are needed.
```
@github-actions github-actions bot added this to the v3.16.0 milestone Jul 25, 2022
@mbfrahry
Copy link
Member

Hey @9numbernine9! Sorry for the regression here. We got a fix in with #17732 and just pushed a release out to 3.15.1. Let me know if that fixes up this issue for you!

@9numbernine9
Copy link
Author

@mbfrahry The new version does appear to fix the issue! Thanks for the quick fix! 👍

@github-actions
Copy link

github-actions bot commented Aug 1, 2022

This functionality has been released in v3.16.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

github-actions bot commented Sep 1, 2022

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants