The documentation (and code) for morpheus_user resource has password and role_ids marked as optional. However creation of the resource will fail if those are not set.
Terraform will perform the following actions:
# morpheus_user.user1 will be created
+ resource "morpheus_user" "user1" {
+ email = "user1@example.com"
+ first_name = (known after apply)
+ id = (known after apply)
+ last_name = (known after apply)
+ linux_keypair_id = (known after apply)
+ linux_username = (known after apply)
+ tenant_id = (known after apply)
+ username = "user1"
+ windows_username = (known after apply)
}
Plan: 1 to add, 0 to change, 0 to destroy.
Error on apply
2024-04-18T22:32:13.843Z [INFO] provider.terraform-provider-morpheus_v0.9.8: 2024/04/18 22:32:13 API FAILURE: Response HTTP: 400 Success: false Size: 107B Body: {"user":null,"success":false,"errors":{"password":"Please enter a password","role":"Please select a role"}} - API returned HTTP 400: timestamp=2024-04-18T22:32:13.842Z
Good Resource
However adding password and role_ids allows it to work:
Terraform will perform the following actions:
# morpheus_user.user1 will be created
+ resource "morpheus_user" "user1" {
+ email = "user1@example.com"
+ first_name = (known after apply)
+ id = (known after apply)
+ last_name = (known after apply)
+ linux_keypair_id = (known after apply)
+ linux_username = (known after apply)
+ password = (sensitive value)
+ role_ids = [
+ 5,
]
+ tenant_id = (known after apply)
+ username = "user1"
+ windows_username = (known after apply)
}
Plan: 1 to add, 0 to change, 0 to destroy.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
morpheus_user.user1: Creating...
morpheus_user.user1: Creation complete after 0s [id=6]
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
The documentation (and code) for
morpheus_user
resource haspassword
androle_ids
marked as optional. However creation of the resource will fail if those are not set.Bad resource
Plan
Error on apply
Good Resource
However adding password and role_ids allows it to work:
Success