Skip to content

Commit

Permalink
SCALRCORE-19437 display error from API while creating AP.
Browse files Browse the repository at this point in the history
  • Loading branch information
vaniakov committed Aug 12, 2021
1 parent 73d5955 commit 22f0d71
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -15,7 +15,7 @@ Extract the archive to get the provider binary.
Follow the instructions on the [official documentation page](https://docs.scalr.com/en/latest/scalr-terraform-provider/index.html) to learn how to use it.
## Developing the provider
### Requirements
- [Terraform](https://www.terraform.io/downloads.html) >= 0.12.x
- [Terraform](https://www.terraform.io/downloads.html) >= 0.15.x
- [Go](https://golang.org/doc/install) >= 1.13
- [jq](https://stedolan.github.io/jq/) >= 1.0

Expand Down
2 changes: 1 addition & 1 deletion scalr/resource_scalr_access_policy.go
Expand Up @@ -158,7 +158,7 @@ func resourceScalrAccessPolicyCreate(d *schema.ResourceData, meta interface{}) e
ap, err := scalrClient.AccessPolicies.Create(ctx, options)
if err != nil {
return fmt.Errorf(
"Error creating access policy for %s %s on %s %s", subjectType, subjectId, scopeType, scopeId)
"Error creating access policy for %s %s on %s %s: %v", subjectType, subjectId, scopeType, scopeId, err)
}
d.SetId(ap.ID)
return resourceScalrAccessPolicyRead(d, meta)
Expand Down
2 changes: 1 addition & 1 deletion scalr/resource_scalr_role.go
Expand Up @@ -95,7 +95,6 @@ func resourceScalrRoleRead(d *schema.ResourceData, meta interface{}) error {
id := d.Id()
log.Printf("[DEBUG] Read configuration of role: %s", id)
role, err := scalrClient.Roles.Read(ctx, id)
log.Printf("[DEBUG] role permissions: %+v", role.Permissions)
if err != nil {
if err == scalr.ErrResourceNotFound {
log.Printf("[DEBUG] Role %s not found", id)
Expand All @@ -104,6 +103,7 @@ func resourceScalrRoleRead(d *schema.ResourceData, meta interface{}) error {
}
return fmt.Errorf("Error reading configuration of role %s: %v", id, err)
}
log.Printf("[DEBUG] role permissions: %+v", role.Permissions)

// Update the config.
d.Set("name", role.Name)
Expand Down

0 comments on commit 22f0d71

Please sign in to comment.