Skip to content

Commit

Permalink
Addressing pull request feedback.
Browse files Browse the repository at this point in the history
* Remove the explicit *schema.Schema calls.
* Move the SetId out from between the error checking.
  • Loading branch information
fitbit-greg committed Sep 17, 2018
1 parent 19206c9 commit 3df010a
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions vault/resource_gcp_auth_backend_role.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,37 +20,37 @@ func gcpAuthBackendRoleResource() *schema.Resource {
Delete: gcpAuthResourceDelete,

Schema: map[string]*schema.Schema{
"role": &schema.Schema{
"role": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"type": &schema.Schema{
"type": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"project_id": &schema.Schema{
"project_id": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"ttl": &schema.Schema{
"ttl": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"max_ttl": &schema.Schema{
"max_ttl": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"period": &schema.Schema{
"period": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"policies": &schema.Schema{
"policies": {
Type: schema.TypeSet,
Elem: &schema.Schema{
Type: schema.TypeString,
Expand Down Expand Up @@ -122,8 +122,8 @@ func gcpAuthResourceWrite(d *schema.ResourceData, meta interface{}) error {
}

log.Printf("[DEBUG] Writing role %q to GCP auth backend", path)
_, err := client.Logical().Write(path, data)
d.SetId(path)
_, err := client.Logical().Write(path, data)
if err != nil {
d.SetId("")
return fmt.Errorf("Error writing GCP auth role %q: %s", path, err)
Expand Down

0 comments on commit 3df010a

Please sign in to comment.