Skip to content

Commit

Permalink
[IAM]: fix opentelekomcloud_identity_user_v3 attribute output (#2283)
Browse files Browse the repository at this point in the history
[IAM]: fix `opentelekomcloud_identity_user_v3` attribute output

Summary of the Pull Request
Fix domain_id attribute output for opentelekomcloud_identity_user_v3.
PR Checklist

 Refers to: #2281
 Tests passed.
 Documentation updated.
 Schema updated.
 Release notes added.

Acceptance Steps Performed
=== RUN   TestAccIdentityV3User_basic
--- PASS: TestAccIdentityV3User_basic (43.67s)
=== RUN   TestAccIdentityV3User_importBasic
--- PASS: TestAccIdentityV3User_importBasic (31.44s)
=== RUN   TestAccCheckIAMV3EmailValidation
--- PASS: TestAccCheckIAMV3EmailValidation (4.84s)
=== RUN   TestAccCheckIAMV3SendEmailValidation
--- PASS: TestAccCheckIAMV3SendEmailValidation (3.70s)
PASS

Process finished with the exit code 0

Reviewed-by: Anton Sidelnikov
Reviewed-by: Vladimir Vshivkov
  • Loading branch information
artem-lifshits committed Aug 24, 2023
1 parent 90523da commit c622fb2
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/resources/identity_user_v3.md
Expand Up @@ -69,6 +69,8 @@ In addition to all arguments above, the following attributes are exported:

* `last_login` - The time when the IAM user last login.

* `domain_id` - The domain user belongs to.

## Import

Users can be imported using the `id`, e.g.
Expand Down
Expand Up @@ -37,6 +37,7 @@ func TestAccIdentityV3User_basic(t *testing.T) {
resource.TestCheckResourceAttrPtr(resourceName, "name", &user.Name),
resource.TestCheckResourceAttr(resourceName, "enabled", "true"),
resource.TestCheckResourceAttr(resourceName, "email", "test@acme.org"),
resource.TestCheckResourceAttrSet(resourceName, "domain_id"),
),
},
{
Expand All @@ -46,6 +47,7 @@ func TestAccIdentityV3User_basic(t *testing.T) {
resource.TestCheckResourceAttrPtr(resourceName, "name", &user.Name),
resource.TestCheckResourceAttr(resourceName, "enabled", "false"),
resource.TestCheckResourceAttr(resourceName, "email", "test2@acme.org"),
resource.TestCheckResourceAttrSet(resourceName, "domain_id"),
),
},
},
Expand Down
Expand Up @@ -98,6 +98,10 @@ func ResourceIdentityUserV3() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"domain_id": {
Type: schema.TypeString,
Computed: true,
},
},
}
}
Expand Down Expand Up @@ -178,6 +182,7 @@ func resourceIdentityUserV3Read(ctx context.Context, d *schema.ResourceData, met
d.Set("pwd_reset", user.PasswordStatus),
d.Set("create_time", user.CreateAt),
d.Set("last_login", user.LastLogin),
d.Set("domain_id", user.DomainID),
)

if err = mErr.ErrorOrNil(); err != nil {
Expand Down
5 changes: 5 additions & 0 deletions releasenotes/notes/users_domain-a63c7989c9e87ce9.yaml
@@ -0,0 +1,5 @@
---
fixes:
- |
**[IAM]** Fix ``resource/opentelekomcloud_identity_user_v3`` to return `domain_id` attribute (`#2283 <https://github.com/opentelekomcloud/terraform-provider-opentelekomcloud/pull/2283>`_)

0 comments on commit c622fb2

Please sign in to comment.