Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authorization: upgrading to the 2018-01-01 Preview SDK #1284

Merged
merged 4 commits into from
May 24, 2018

Conversation

tombuildsstuff
Copy link
Contributor

Trying to create a Role Assignment using a Role that's got Data Actions assigned returns the following error:

authorization.RoleAssignmentsClient#Create: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="UnsupportedApiVersionForRoleDefinitionHasDataActions" Message="Assignments to roles with DataActions and NotDataActions are not supported on API version '2015-07-01'. The minimum required API version for this operations is '2018-01-01-preview'."

I'd consider this an API bug (and have raised this SDK issue) - but we can work around this in Terraform by upgrading to the new Preview API (which I've done here).

This PR also fixes the intermittently failing Role Assignments tests, where the tests were running in parallel using the same Role Definition (thus causing conflicts).

Fixes #1280

Tests pass

```
$ acctests azurerm TestAccAzureRMRole
=== RUN   TestAccAzureRMRoleDefinition_importBasic
--- PASS: TestAccAzureRMRoleDefinition_importBasic (24.38s)
=== RUN   TestAccAzureRMRoleDefinition_importComplete
--- PASS: TestAccAzureRMRoleDefinition_importComplete (14.14s)
=== RUN   TestAccAzureRMRoleAssignment
=== RUN   TestAccAzureRMRoleAssignment/basic
=== RUN   TestAccAzureRMRoleAssignment/basic/roleName
=== RUN   TestAccAzureRMRoleAssignment/basic/builtin
=== RUN   TestAccAzureRMRoleAssignment/basic/custom
=== RUN   TestAccAzureRMRoleAssignment/basic/emptyName
=== RUN   TestAccAzureRMRoleAssignment/import
=== RUN   TestAccAzureRMRoleAssignment/import/basic
=== RUN   TestAccAzureRMRoleAssignment/import/custom
--- PASS: TestAccAzureRMRoleAssignment (118.70s)
    --- PASS: TestAccAzureRMRoleAssignment/basic (77.01s)
        --- PASS: TestAccAzureRMRoleAssignment/basic/roleName (19.05s)
        --- PASS: TestAccAzureRMRoleAssignment/basic/builtin (17.87s)
        --- PASS: TestAccAzureRMRoleAssignment/basic/custom (22.59s)
        --- PASS: TestAccAzureRMRoleAssignment/basic/emptyName (17.51s)
    --- PASS: TestAccAzureRMRoleAssignment/import (41.69s)
        --- PASS: TestAccAzureRMRoleAssignment/import/basic (21.88s)
        --- PASS: TestAccAzureRMRoleAssignment/import/custom (19.80s)
=== RUN   TestAccAzureRMRoleDefinition_basic
--- PASS: TestAccAzureRMRoleDefinition_basic (14.59s)
=== RUN   TestAccAzureRMRoleDefinition_complete
--- PASS: TestAccAzureRMRoleDefinition_complete (12.99s)
=== RUN   TestAccAzureRMRoleDefinition_update
--- PASS: TestAccAzureRMRoleDefinition_update (22.03s)
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm	206.861s
```
Tests pass:

```
$ acctests azurerm TestAccAzureRMRole
=== RUN   TestAccAzureRMRoleDefinition_importBasic
--- PASS: TestAccAzureRMRoleDefinition_importBasic (24.71s)
=== RUN   TestAccAzureRMRoleDefinition_importComplete
--- PASS: TestAccAzureRMRoleDefinition_importComplete (14.30s)
=== RUN   TestAccAzureRMRoleAssignment
=== RUN   TestAccAzureRMRoleAssignment/basic
=== RUN   TestAccAzureRMRoleAssignment/basic/emptyName
=== RUN   TestAccAzureRMRoleAssignment/basic/roleName
=== RUN   TestAccAzureRMRoleAssignment/basic/dataActions
=== RUN   TestAccAzureRMRoleAssignment/basic/builtin
=== RUN   TestAccAzureRMRoleAssignment/basic/custom
=== RUN   TestAccAzureRMRoleAssignment/import
=== RUN   TestAccAzureRMRoleAssignment/import/basic
=== RUN   TestAccAzureRMRoleAssignment/import/custom
--- PASS: TestAccAzureRMRoleAssignment (140.30s)
    --- PASS: TestAccAzureRMRoleAssignment/basic (95.32s)
        --- PASS: TestAccAzureRMRoleAssignment/basic/emptyName (19.34s)
        --- PASS: TestAccAzureRMRoleAssignment/basic/roleName (15.95s)
        --- PASS: TestAccAzureRMRoleAssignment/basic/dataActions (19.54s)
        --- PASS: TestAccAzureRMRoleAssignment/basic/builtin (17.11s)
        --- PASS: TestAccAzureRMRoleAssignment/basic/custom (23.38s)
    --- PASS: TestAccAzureRMRoleAssignment/import (44.98s)
        --- PASS: TestAccAzureRMRoleAssignment/import/basic (22.07s)
        --- PASS: TestAccAzureRMRoleAssignment/import/custom (22.91s)
=== RUN   TestAccAzureRMRoleDefinition_basic
--- PASS: TestAccAzureRMRoleDefinition_basic (13.78s)
=== RUN   TestAccAzureRMRoleDefinition_complete
--- PASS: TestAccAzureRMRoleDefinition_complete (12.98s)
=== RUN   TestAccAzureRMRoleDefinition_update
--- PASS: TestAccAzureRMRoleDefinition_update (23.25s)
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm	229.356s
```
@tombuildsstuff tombuildsstuff merged commit cd1a601 into master May 24, 2018
@tombuildsstuff tombuildsstuff deleted the authorization-sdk branch May 24, 2018 10:28
tombuildsstuff added a commit that referenced this pull request May 24, 2018
@ghost
Copy link

ghost commented Mar 31, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

how to change the API version in Terraform. (Error on required API version)
2 participants