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

Support creating Azure secret backend role by specifying the role_id #1573

Merged
merged 2 commits into from
Aug 15, 2022

Conversation

maxcoulombe
Copy link
Contributor

@maxcoulombe maxcoulombe commented Aug 9, 2022

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" comments, they generate extra noise for pull request followers and do not help prioritize the request

Closes #715

Release note for CHANGELOG:

+ support creating Azure secret backend role by specifying the role_id
+ added validation so only role_id or role_name is provided but not both
+ added acceptance test
* converted from the deprecated schema callbacks to their version with Context & Diagnostics
* various small formatting, warnings and standardization fixes

Output from acceptance testing:

$ TESTARGS="--run TestAzureSecretBackendRole" make testacc
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test -v --run TestAzureSecretBackendRole -timeout 30m ./...
(...)
2022/08/09 20:17:00 [INFO] Using Vault token with the following policies: root
=== RUN   TestAzureSecretBackendRole
--- PASS: TestAzureSecretBackendRole (0.30s)
PASS
ok  	github.com/hashicorp/terraform-provider-vault/vault	0.316s

+ added validation so only role_id or role_name is provided but not both
+ added acceptance test
* converted from the deprecated schema callbacks to their version with Context & Diagnostics
* various small formatting, warnings and standardization fixes
@github-actions github-actions bot added the size/M label Aug 9, 2022
@maxcoulombe maxcoulombe requested a review from a team August 10, 2022 00:14
Copy link
Contributor

@vinay-gopalan vinay-gopalan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Had one nit about a style precedent, but otherwise looks good

err := azureSecretBackendRoleUpdateFields(d, data)
if err != nil {
return err
diags := azureSecretBackendRoleUpdateFields(ctx, d, data)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like you're only returning diags if there is an error; else it is nil, in that case we have a style precedent of something like

if diags := azureSecretBackendRoleUpdateFields(ctx, d, data); diags != nil {
    return diags
}

@@ -47,6 +48,10 @@ func TestAzureSecretBackendRole(t *testing.T) {
resource.TestCheckResourceAttrSet("vault_azure_secret_backend_role.test_azure_groups", "azure_groups.0.object_id"),
),
},
{
Config: testAzureSecretBackendRoleConfigError(subscriptionID, tenantID, clientID, clientSecret, path, role, resourceGroup),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Read: ReadWrapper(azureSecretBackendRoleRead),
Update: azureSecretBackendRoleCreate,
Delete: azureSecretBackendRoleDelete,
CreateContext: azureSecretBackendRoleCreate,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for updating these!

@maxcoulombe maxcoulombe merged commit 5d632d0 into main Aug 15, 2022
@maxcoulombe maxcoulombe deleted the vault-6260-AzureBackendRoleById branch August 15, 2022 14:20
@benashz benashz added this to the 3.9.0 milestone Oct 5, 2022
marcboudreau pushed a commit to marcboudreau/terraform-provider-vault that referenced this pull request Nov 6, 2022
…ashicorp#1573)

* + support creating Azure secret backend role by specifying the role_id
+ added validation so only role_id or role_name is provided but not both
+ added acceptance test
* converted from the deprecated schema callbacks to their version with Context & Diagnostics
* various small formatting, warnings and standardization fixes

* * normalize style of diags.err hangling
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request : Allow specifying role by id in vault_azure_secret_backend_role
3 participants