Skip to content

[Bug]: Error in resource mongodbatlas_cloud_user_team_assignment when updating resource mongodbatlas_organization #3831

@a88zach

Description

@a88zach

Is there an existing issue for this?

  • I have searched the existing issues

Provider Version

v2.1.0

Terraform Version

v1.13.4

Terraform Edition

Terraform Cloud

Current Behavior

When updating a mongodbatlas_organization resource (add security contact), the existing mongodbatlas_cloud_user_team_assignment resources error because the user_id is undefined

Error: Missing Configuration for Required Attribute
│ 
│   with mongodbatlas_cloud_user_team_assignment.platform_admin_foo,
│   on user-team-assignments.tf line 22, in resource "mongodbatlas_cloud_user_team_assignment" "platform_admin_foo":
│   22:   user_id = data.mongodbatlas_cloud_user_org_assignment.foo.user_id
│ 
│ Must set a configuration value for the user_id attribute as the provider
│ has marked it as required.

Terraform configuration to reproduce the issue

resource "mongodbatlas_organization" "org" {
  name = "Org Name"
}

data "mongodbatlas_cloud_user_org_assignment" "foo" {
  org_id   = mongodbatlas_organization.org.org_id
  username = "[email protected]"
}

resource "mongodbatlas_team" "platform_admin" {
  org_id = mongodbatlas_organization.org.org_id
  name   = "platform-admin"
}

resource "mongodbatlas_cloud_user_team_assignment" "platform_admin_foo" {
  org_id  = mongodbatlas_organization.org.org_id
  team_id = mongodbatlas_team.platform_admin.team_id
  user_id = data.mongodbatlas_cloud_user_org_assignment.foo.user_id
}

Steps To Reproduce

Once you have applied the change above, add the security contact to the org resource and run a plan. This will result in the following error Error: Missing Configuration for Required Attribute

Logs

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions