Skip to content

Commit

Permalink
Add username computed attribute to resource
Browse files Browse the repository at this point in the history
  • Loading branch information
sebasslash committed Oct 20, 2022
1 parent 9f6695d commit e984771
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tfe/resource_tfe_organization_membership.go
Expand Up @@ -34,6 +34,11 @@ func resourceTFEOrganizationMembership() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},

"username": {
Type: schema.TypeString,
Computed: true,
},
},
}
}
Expand Down Expand Up @@ -84,6 +89,7 @@ func resourceTFEOrganizationMembershipRead(d *schema.ResourceData, meta interfac
d.Set("email", membership.Email)
d.Set("organization", membership.Organization.Name)
d.Set("user_id", membership.User.ID)
d.Set("username", membership.User.Username)

return nil
}
Expand Down
2 changes: 2 additions & 0 deletions tfe/resource_tfe_organization_membership_test.go
Expand Up @@ -32,6 +32,8 @@ func TestAccTFEOrganizationMembership_basic(t *testing.T) {
resource.TestCheckResourceAttr(
"tfe_organization_membership.foobar", "organization", orgName),
resource.TestCheckResourceAttrSet("tfe_organization_membership.foobar", "user_id"),
resource.TestCheckResourceAttr(
"tfe_organization_membership.foobar", "username", ""),
),
},
},
Expand Down

0 comments on commit e984771

Please sign in to comment.