Control: 6.2 Ensure no resources are created in the root compartment
Description
When you create a cloud resource such as an instance, block volume, or cloud network, you must specify to which compartment you want the resource to belong. Placing resources in the root compartment makes it difficult to organize and isolate those resources.
Placing resources into a compartment will allow you to organize and have more granular access controls to your cloud resources.
Remediation
From Console
- Follow audit procedure above.
- For each item in the returned results, click the item name.
- Then select
Move Resource
orMore Actions
thenMove Resource
. - Select a compartment that is not the root compartment in
CHOOSE NEW COMPARTMENT
. - Click
Move Resource
.
From CLI
- Follow the audit procedure above.
- For each bucket item execute the below command:
oci os bucket update --bucket-name <bucket-name> --compartment-id <not rootcompartment-id>
- For other resources use the change-compartment command for the resource type:
oci <service-command> <resource-command> change-compartment --<item-id> <item-id> --compartment-id <not root compartment-id>i. Example for an Autonomous Database:oci db autonomous-database change-compartment --autonomous-database-id<autonmous-database-id> --compartment-id <not root compartment-id>
Usage
Run the control in your terminal:
powerpipe control run oci_compliance.control.cis_v200_6_2
Snapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run oci_compliance.control.cis_v200_6_2 --share
SQL
This control uses a named query:
manual_control