Skip to content

Commit

Permalink
Add disabled attribute to service account data source (#12129) (#20034)
Browse files Browse the repository at this point in the history
[upstream:93c6b4348e7cbffe39ca2b767072c0c7bbd19973]

Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
modular-magician authored Oct 25, 2024
1 parent 6d0f9b9 commit 2c32737
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .changelog/12129.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:new-datasource
resourcemanager: added `disabled` to `google_service_account` datasource
```
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ func DataSourceGoogleServiceAccount() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"disabled": {
Type: schema.TypeBool,
Computed: true,
},
},
}
}
Expand Down Expand Up @@ -86,6 +90,9 @@ func dataSourceGoogleServiceAccountRead(d *schema.ResourceData, meta interface{}
if err := d.Set("member", "serviceAccount:"+sa.Email); err != nil {
return fmt.Errorf("Error setting member: %s", err)
}
if err := d.Set("disabled", sa.Disabled); err != nil {
return fmt.Errorf("Error setting disabled: %s", err)
}

return nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ func TestAccDatasourceGoogleServiceAccount_basic(t *testing.T) {
resource.TestCheckResourceAttrSet(resourceName, "name"),
resource.TestCheckResourceAttrSet(resourceName, "display_name"),
resource.TestCheckResourceAttrSet(resourceName, "member"),
resource.TestCheckResourceAttrSet(resourceName, "disabled"),
),
},
},
Expand Down
2 changes: 2 additions & 0 deletions website/docs/d/service_account.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,5 @@ exported:
* `display_name` - The display name for the service account.

* `member` - The Identity of the service account in the form `serviceAccount:{email}`. This value is often used to refer to the service account in order to grant IAM permissions.

* `disabled` - Whether a service account is disabled or not.

0 comments on commit 2c32737

Please sign in to comment.