tabular-io / terraform-provider-tabular

Mozilla Public License 2.0
3 stars 1 forks source link

Role database grants #6

Closed maxwell-gobel closed 1 year ago

maxwell-gobel commented 1 year ago

Import

``` ❯ terraform state rm tabular_role_database_grants.grants Removed tabular_role_database_grants.grants Successfully removed 1 resource instance(s). ❯ terraform import tabular_role_database_grants.grants "fb0723be-72e7-414c-b060-0a4e3c6d8cdc/dirt/Example Role 1" tabular_role_database_grants.grants: Importing from ID "fb0723be-72e7-414c-b060-0a4e3c6d8cdc/dirt/Example Role 1"... tabular_role_database_grants.grants: Import prepared! Prepared tabular_role_database_grants for import tabular_role_database_grants.grants: Refreshing state... Import successful! The resources that were imported are shown above. These resources are now in your Terraform state and will henceforth be managed by Terraform. ❯ terraform plan tabular_role.example3: Refreshing state... [id=50b6d4ad-6093-4f3f-a87d-4231146a16e0] tabular_role.example2: Refreshing state... [id=ba659409-42df-454a-a9b6-9ce436d460d2] tabular_role.example: Refreshing state... [id=42836efc-3f2f-43e5-9484-48fa60fcbf3d] tabular_role_relationship.inheritance: Refreshing state... tabular_role_database_grants.grants: Refreshing state... No changes. Your infrastructure matches the configuration. Terraform has compared your real infrastructure against your configuration and found no differences, so no changes are needed. ```

Create

``` ❯ terraform apply tabular_role.example2: Refreshing state... [id=ba659409-42df-454a-a9b6-9ce436d460d2] tabular_role.example3: Refreshing state... [id=50b6d4ad-6093-4f3f-a87d-4231146a16e0] tabular_role.example: Refreshing state... [id=42836efc-3f2f-43e5-9484-48fa60fcbf3d] tabular_role_relationship.inheritance: Refreshing state... Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: + create Terraform will perform the following actions: # tabular_role_database_grants.grants will be created + resource "tabular_role_database_grants" "grants" { + database = "dirt" + privileges = [ + "CREATE_TABLE", + "LIST_TABLES", + "MODIFY_DATABASE", ] + privileges_with_grant = [ + "FUTURE_DROP_TABLE", + "FUTURE_SELECT", + "FUTURE_UPDATE", ] + role_name = "Example Role 1" + warehouse_id = "fb0723be-72e7-414c-b060-0a4e3c6d8cdc" } Plan: 1 to add, 0 to change, 0 to destroy. Do you want to perform these actions? Terraform will perform the actions described above. Only 'yes' will be accepted to approve. Enter a value: yes tabular_role_database_grants.grants: Creating... tabular_role_database_grants.grants: Creation complete after 0s Apply complete! Resources: 1 added, 0 changed, 0 destroyed. ```

Destroy

``` ❯ terraform destroy -target 'tabular_role_database_grants.grants' tabular_role.example: Refreshing state... [id=42836efc-3f2f-43e5-9484-48fa60fcbf3d] tabular_role_database_grants.grants: Refreshing state... Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: - destroy Terraform will perform the following actions: # tabular_role_database_grants.grants will be destroyed - resource "tabular_role_database_grants" "grants" { - database = "dirt" -> null - privileges = [ - "CREATE_TABLE", - "LIST_TABLES", - "MODIFY_DATABASE", ] -> null - privileges_with_grant = [ - "FUTURE_DROP_TABLE", - "FUTURE_SELECT", - "FUTURE_UPDATE", ] -> null - role_name = "Example Role 1" -> null - warehouse_id = "fb0723be-72e7-414c-b060-0a4e3c6d8cdc" -> null } Plan: 0 to add, 0 to change, 1 to destroy. ╷ │ Warning: Resource targeting is in effect │ │ You are creating a plan with the -target option, which means that the result of this plan may not represent all of the changes requested by the current configuration. │ │ The -target option is not for routine use, and is provided only for exceptional situations such as recovering from errors or mistakes, or when Terraform specifically suggests to use it as part of an error message. ╵ Do you really want to destroy all resources? Terraform will destroy all your managed infrastructure, as shown above. There is no undo. Only 'yes' will be accepted to confirm. Enter a value: yes tabular_role_database_grants.grants: Destroying... tabular_role_database_grants.grants: Destruction complete after 1s ╷ │ Warning: Applied changes may be incomplete │ │ The plan was created with the -target option in effect, so some changes requested in the configuration may have been ignored and the output values may not be fully updated. Run the following command to verify that no other changes are pending: │ terraform plan │ │ Note that the -target option is not suitable for routine use, and is provided only for exceptional situations such as recovering from errors or mistakes, or when Terraform specifically suggests to use it as part of an error message. ╵ Destroy complete! Resources: 1 destroyed. ```

Update

``` ❯ terraform apply tabular_role.example2: Refreshing state... [id=ba659409-42df-454a-a9b6-9ce436d460d2] tabular_role.example3: Refreshing state... [id=50b6d4ad-6093-4f3f-a87d-4231146a16e0] tabular_role.example: Refreshing state... [id=42836efc-3f2f-43e5-9484-48fa60fcbf3d] tabular_role_database_grants.grants: Refreshing state... tabular_role_relationship.inheritance: Refreshing state... Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: ~ update in-place Terraform will perform the following actions: # tabular_role_database_grants.grants will be updated in-place ~ resource "tabular_role_database_grants" "grants" { ~ privileges = [ # (1 unchanged element hidden) "LIST_TABLES", + "MODIFY_DATABASE", ] ~ privileges_with_grant = [ # (1 unchanged element hidden) "FUTURE_SELECT", - "FUTURE_UPDATE", ] # (3 unchanged attributes hidden) } Plan: 0 to add, 1 to change, 0 to destroy. Do you want to perform these actions? Terraform will perform the actions described above. Only 'yes' will be accepted to approve. Enter a value: yes tabular_role_database_grants.grants: Modifying... tabular_role_database_grants.grants: Modifications complete after 1s Apply complete! Resources: 0 added, 1 changed, 0 destroyed. ```