aws_policy_delete | R Documentation |
Delete a user managed policy
aws_policy_delete(name)
name |
(character) a policy name. required. within the function we lookup the policy arn which is what's passed to the AWS API |
invisibly returns NULL
You can not delete AWS managed policies.
paws
docs)Before you can delete a managed policy, you must first detach the policy from all users, groups, and roles that it is attached to. In addition, you must delete all the policy's versions. The following steps describe the process for deleting a managed policy:
Detach the policy from all users, groups, and roles that the policy is
attached to using aws_policy_attach()
. To list all the users, groups,
and roles that a policy is attached to use aws_policy_list_entities()
Delete all versions of the policy using aws_policy_delete_version()
.
To list the policy's versions, use aws_policy_list_versions()
. You cannot
use aws_policy_delete_version()
to delete the version that is marked as
the default version. You delete the policy's default version in the next
step of the process.
Delete the policy using this function (this automatically deletes the policy's default version)
Other policies:
as_policy_arn()
,
aws_policies()
,
aws_policy()
,
aws_policy_attach()
,
aws_policy_create()
,
aws_policy_delete_version()
,
aws_policy_detach()
,
aws_policy_exists()
,
aws_policy_list_entities()
,
aws_policy_list_versions()
,
aws_policy_update()
if (aws_policy_exists("RdsAllow456")) {
aws_policy_delete("RdsAllow456")
}
# Create policy document
doc <- aws_policy_document_create(
aws_policy_statement(
action = "rds-db:connect",
resource = "*"
)
)
# Create policy
invisible(aws_policy_create("RdsAllow456", document = doc))
# Delete policy
aws_policy_delete("RdsAllow456")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.