Deleting an access policy
Access policies are a Yandex Identity and Access Management mechanism that allows you to manage permissions for specific operations with Yandex Cloud resources. Access policies are based on templates and complement the role system for more flexible access management.
You can delete an access policy created for a folder, cloud, or organization.
Note
To manage access policies, a user must have one of the following roles:
resource-manager.adminoradminfor the folder or cloud to manage access policies at the folder or cloud level, respectively.organization-manager.adminoradminfor the organization to manage access policies at the organization level.
Deleting an access policy created for a folder
To delete an access policy created for a folder:
If you do not have the Yandex Cloud CLI yet, install and initialize it.
-
Get a list of IDs of access policy templates assigned for the folder.
-
Run this command:
yc resource-manager folder unbind-access-policy \ --name <folder_name> \ --access-policy-template-id=<policy_template_ID>Where:
--name: Name of the folder to delete the policy for. Instead of the folder name, you can provide its ID in the--idparameter.--access-policy-template-id: ID of the access policy template you want to delete for the specified folder.
-
Make sure the policy was deleted.
With Terraform
Terraform is distributed under the Business Source License
For more information about the provider resources, see the guides on the Terraform
If you do not have Terraform yet, install it and configure the Yandex Cloud provider.
To manage infrastructure using Terraform under a service account or user accounts (a Yandex account, a federated account, or a local user), authenticate using the appropriate method.
-
In the configuration, locate the
yandex_resource_manager_folder_iam_policy_bindingresource with the IDs of the policy template inaccess_policy_template_idand folder infolder_id. -
Remove the section of that resource. Do not delete the folder resource itself.
-
Apply the configuration:
-
In the terminal, navigate to the configuration file directory.
-
Make sure the configuration is correct using this command:
terraform validateIf the configuration is valid, you will get this message:
Success! The configuration is valid. -
Run this command:
terraform planYou will see a list of resources and their properties. No changes will be made at this step. Terraform will show any errors in the configuration.
-
Apply the configuration changes:
terraform apply -
Type
yesand press Enter to confirm the changes.
Make sure the plan removes only the correct policy binding. These steps apply to the binding managed by the current Terraform configuration.
-
Use the unbindAccessPolicy REST API method for the Folder resource or the FolderService/UnbindAccessPolicy gRPC API call.
The specified access policy will no longer apply to resources in the specified folder.
Deleting an access policy created for a cloud
To delete an access policy created for a cloud:
If you do not have the Yandex Cloud CLI yet, install and initialize it.
-
Get a list of IDs of access policy templates assigned for the cloud.
-
Run this command:
yc resource-manager cloud unbind-access-policy \ --name <cloud_name> \ --access-policy-template-id=<policy_template_ID>Where:
--name: Name of the cloud to delete the policy for. Instead of the cloud name, you can provide its ID in the--idparameter.--access-policy-template-id: ID of the access policy template you want to delete for the specified cloud.
-
Make sure the policy was deleted.
With Terraform
Terraform is distributed under the Business Source License
For more information about the provider resources, see the guides on the Terraform
If you do not have Terraform yet, install it and configure the Yandex Cloud provider.
To manage infrastructure using Terraform under a service account or user accounts (a Yandex account, a federated account, or a local user), authenticate using the appropriate method.
-
In the configuration, locate the
yandex_resource_manager_cloud_iam_policy_bindingresource with the IDs of the policy template inaccess_policy_template_idand cloud incloud_id. -
Remove the section of that resource. The cloud resource itself should not be deleted.
-
Apply the configuration:
-
In the terminal, navigate to the configuration file directory.
-
Make sure the configuration is correct using this command:
terraform validateIf the configuration is valid, you will get this message:
Success! The configuration is valid. -
Run this command:
terraform planYou will see a list of resources and their properties. No changes will be made at this step. Terraform will show any errors in the configuration.
-
Apply the configuration changes:
terraform apply -
Type
yesand press Enter to confirm the changes.
Make sure the plan removes only the correct policy binding. These steps apply to the binding managed by the current Terraform configuration.
-
Use the unbindAccessPolicy REST API method for the Cloud resource or the CloudService/UnbindAccessPolicy gRPC API call.
The specified access policy will no longer apply to resources within all folders in the given cloud.
Deleting an access policy created for an organization
To delete an access policy created for an organization, follow these steps:
If you do not have the Yandex Cloud CLI yet, install and initialize it.
-
Get a list of IDs of access policy templates assigned for the organization.
-
Run this command:
yc organization-manager organization unbind-access-policy \ --name <organization_name> \ --access-policy-template-id=<policy_template_ID>Where:
--name: Name of the organization to delete the policy for. Instead of the organization name, you can provide its ID in the--idparameter.--access-policy-template-id: ID of the access policy template you want to delete for the specified organization.
-
Make sure the policy was deleted.
With Terraform
Terraform is distributed under the Business Source License
For more information about the provider resources, see the guides on the Terraform
If you do not have Terraform yet, install it and configure the Yandex Cloud provider.
To manage infrastructure using Terraform under a service account or user accounts (a Yandex account, a federated account, or a local user), authenticate using the appropriate method.
-
In the configuration, locate the
yandex_organization_manager_organization_iam_policy_bindingresource with the IDs of the policy template inaccess_policy_template_idand organization inorganization_id. -
Remove the section of that resource. The organization resource itself should not be deleted.
-
Apply the configuration:
-
In the terminal, navigate to the configuration file directory.
-
Make sure the configuration is correct using this command:
terraform validateIf the configuration is valid, you will get this message:
Success! The configuration is valid. -
Run this command:
terraform planYou will see a list of resources and their properties. No changes will be made at this step. Terraform will show any errors in the configuration.
-
Apply the configuration changes:
terraform apply -
Type
yesand press Enter to confirm the changes.
Make sure the plan removes only the correct policy binding. These steps apply to the binding managed by the current Terraform configuration.
-
Use the unbindAccessPolicy REST API method for the Organization resource or the OrganizationService/UnbindAccessPolicy gRPC API call.
The access policy will no longer apply to resources within all clouds in the specified organization.