hashicorp / terraform-provider-azurerm

Terraform provider for Azure Resource Manager
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
Mozilla Public License 2.0
4.51k stars 4.6k forks source link

Cannot set multiple azurerm_security_center_contact ressource #18971

Closed sinc59 closed 1 year ago

sinc59 commented 1 year ago

Is there an existing issue for this?

Community Note

Terraform Version

1.3.1

AzureRM Provider Version

3.24.0

Affected Resource(s)/Data Source(s)

azurerm_security_center_contact

Terraform Configuration Files

resource "azurerm_security_center_contact" "example" {
  email = "test@test.fr"
  phone = null

  alert_notifications = true
  alerts_to_admins    = true
}

resource "azurerm_security_center_contact" "example2" {
  email = "contact@example.com"
  phone = null

  alert_notifications = true
  alerts_to_admins    = true
}

Debug Output/Panic Output

Terraform says:
Apply complete! Resources: 2 added, 0 changed, 0 destroyed

Azure cli says:
$ az security contact list
AlertNotifications    AlertsToAdmins    Email                           Location     Name      Phone
--------------------  ----------------  ------------------------------  -----------  --------  -------
On                    On                contact@example.com             West Europe  default1

Expected Behaviour

Two contacts shloud be created. The azurerm_security_center_contact does not have any name argument, he use an predefined name (default1).

I think that the azurerm_security_center_contact resource should have an name option (required, has the azure api specifications).

Actual Behaviour

Terraform seems to create the user with predefined name, when it's create the second user, the api override the first entry insted of create them.

Steps to Reproduce

terraform apply

Important Factoids

No response

References

No response

neil-yechenwei commented 1 year ago

Thanks for raising this issue. Per the clarification, seems only default1 is allowed by API design.

sinc59 commented 1 year ago

Hello, I don't know if the API have evolved but, has you see in the Microsoft documentation , the securityContactName variable is required and not hardcoded on default1.

Also, when i create a security contact with the azure cli, i can set a custom name (required also).

I think that we can try to add a name variable and avoid the hardcoded "default1", (if the azure cli works, the api rest should works as the same (:crossed_fingers: ))

stephybun commented 1 year ago

Closed by #18999

github-actions[bot] commented 1 year ago

This functionality has been released in v3.30.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[bot] commented 1 year ago

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.