From 1535d94c8af544eaefebc3ff509eeeb4e2650fbb Mon Sep 17 00:00:00 2001 From: Ben Duncan <5178243+benduncan@users.noreply.github.com> Date: Wed, 7 Oct 2026 04:48:25 +1000 Subject: [PATCH] Revert "docs: look the OCI compartment OCID up by name" This reverts commit 5443149cce2d22c44bce3698dce2c8d72012afd0. --- docs/oci-integration/README.md | 43 ++++------------------------------ 1 file changed, 5 insertions(+), 38 deletions(-) diff --git a/docs/oci-integration/README.md b/docs/oci-integration/README.md index 6e7e04edd..dac888125 100644 --- a/docs/oci-integration/README.md +++ b/docs/oci-integration/README.md @@ -93,39 +93,10 @@ Once installed configure your OCI credentials (~/.oci/config) which will be used `oci setup config` -Now set `$CID` to the compartment you are deploying into. It is used throughout this guide and again as `compartment_ocid` in step 4, so set it once and keep the same shell. - -The CLI can look it up by name, so there is no OCID to copy: - -```sh -export CID=$(oci iam compartment list --compartment-id-in-subtree true \ - --access-level ACCESSIBLE --all \ - --query "data[?name=='my-compartment' && \"lifecycle-state\"=='ACTIVE'].id | [0]" \ - --raw-output) - -echo "${CID:?no ACTIVE compartment of that name is visible to this profile}" -``` - -The second line is the check, not decoration: the query exits 0 and prints nothing when the name matches nothing, so without it an unset `$CID` reaches Terraform and fails much later with an OCI error that names neither the compartment nor the cause. - -To see the names you can choose from, drop the `--query` and ask for a table: - -```sh -oci iam compartment list --compartment-id-in-subtree true --access-level ACCESSIBLE --all \ - --query 'data[?"lifecycle-state"==`ACTIVE`].{name:name,id:id}' --output table -``` - -Two compartments in one tenancy can share a name. If the table shows the name twice, take the OCID from it and set `$CID` directly, because the lookup above returns the first match and cannot tell you which one you wanted: +Once setup validate your OCI credentials work as expected. `$CID` is the compartment you are deploying into, which is a `ocid1.compartment.oc1..` OCID, or your tenancy OCID if that compartment is the root. The same value is used throughout this guide and again as `compartment_ocid` in step 4. ```sh export CID="ocid1.compartment.oc1..xxx" -``` - -> **Deploy into a compartment, not the tenancy root.** The root's OCID is the tenancy OCID and will work, but the instance-principal policy in step 2.1 is scoped to whatever `$CID` holds, so a root value grants every instance in the tenancy the right to consume the regional public-IP quota. - -Confirm the credential and the compartment together: - -```sh oci compute shape list --compartment-id $CID ``` @@ -193,13 +164,7 @@ There are two ways to provide it, and they differ in who has to authorise them r **Use 2.1 if you are a tenancy admin.** It is the better of the two because there is no key to leak, rotate or forget about, and a replaced node needs no handoff. Use 2.2 when your compartment was allocated to you inside someone else's tenancy, which is the common case and the reason 2.2 exists at all. -Both routes below need `$CID` from the prerequisites, so confirm it is still set in this shell: - -```bash -echo "${CID:?set it as shown under OCI CLI tool}" -``` - -Do one of the two authentication methods below, not both, then continue to step 3. +Do one of the two, not both, then continue to step 3. ### 2.1 Instance principal (preferred) @@ -283,9 +248,11 @@ An email will be sent to the designated `$ADMIN_EMAIL` defined, you are required #### Grant the group its three permissions -Spinifex calls [ten operations](../oci-architecture/README.md#the-iam-policy), and these three statements are what authorise them. This attaches the policy to `$CID`, the compartment you are deploying into. +Spinifex calls [ten operations](../oci-architecture/README.md#the-iam-policy), and these three statements are what authorise them. Attach the policy to the compartment you are deploying into using the command below. Replace `$CID` with that compartment's OCID. ```bash +export CID="ocid1.compartment.oc1..xxx" + oci iam policy create --compartment-id "$CID" --name SpinifexOperators \ --description "Spinifex external-address allocation" \ --statements '[