Skip to content

Commit

Permalink
[CLOUD-1016] Set valid_before/after for google_service_account_key
Browse files Browse the repository at this point in the history
  • Loading branch information
Evan Nemerson authored and evan-fugue committed Dec 7, 2022
1 parent ffb8e61 commit 139e127
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
8 changes: 7 additions & 1 deletion google/data_source_google_service_account_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ package google

import (
"fmt"
"regexp"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
"regexp"
)

func dataSourceGoogleServiceAccountKey() *schema.Resource {
Expand Down Expand Up @@ -75,6 +75,12 @@ func dataSourceGoogleServiceAccountKeyRead(d *schema.ResourceData, meta interfac
if err := d.Set("public_key", sak.PublicKeyData); err != nil {
return fmt.Errorf("Error setting public_key: %s", err)
}
if err := d.Set("valid_before", sak.ValidBeforeTime); err != nil {
return fmt.Errorf("Error setting valid_before: %s", err)
}
if err := d.Set("valid_after", sak.ValidAfterTime); err != nil {
return fmt.Errorf("Error setting valid_after: %s", err)
}

return nil
}
6 changes: 6 additions & 0 deletions google/resource_google_service_account_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,12 @@ func resourceGoogleServiceAccountKeyRead(d *schema.ResourceData, meta interface{
if err := d.Set("public_key", sak.PublicKeyData); err != nil {
return fmt.Errorf("Error setting public_key: %s", err)
}
if err := d.Set("valid_before", sak.ValidBeforeTime); err != nil {
return fmt.Errorf("Error setting valid_before: %s", err)
}
if err := d.Set("valid_after", sak.ValidAfterTime); err != nil {
return fmt.Errorf("Error setting valid_after: %s", err)
}
return nil
}

Expand Down

0 comments on commit 139e127

Please sign in to comment.