Repository navigation
Conversation
`backend "oci"` (Terraform 1.12+) was reported as unsupported, so `oxid init` and `oxid sync` could not import state for OCI users. Parse the oci backend block (bucket, namespace, key defaulting to terraform.tfstate, region, tenancy/user OCIDs, fingerprint, private_key_path, config_file_profile, auth) and fetch the state object from Object Storage with OCI HTTP signature auth (RSA-SHA256 over date, (request-target) and host). Credentials not set in the backend block come from the OCI CLI config file (~/.oci/config or OCI_CLI_CONFIG_FILE), profile DEFAULT unless config_file_profile is set, with missing keys inherited from DEFAULT. Only APIKey auth is supported; instance/resource principals and encrypted keys produce a clear error. Keys downloaded from the OCI console, which end with an OCI_API_KEY marker line, are accepted. Gated behind a new default `oci-backend` feature (rsa, base64). CLI output for remote backends now uses a shared BackendConfig::location(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
@ftgonc approved workflows |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds OCI Object Storage as a remote backend for state import, so
oxid initandoxid syncwork for configurations using Terraform'sbackend "oci"(Terraform 1.12+). Today it falls through toBackendConfig::Unsupportedand users mustterraform state pullby hand.BackendConfig::Ocivariant, parsed from the same attributes as Terraform's backend:bucket,namespace,key(defaults toterraform.tfstate),region,tenancy_ocid,user_ocid,fingerprint,private_key_path,config_file_profile,authsrc/state/oci.rs: fetches the state object with OCI HTTP signature auth (RSA-SHA256 overdate,(request-target),host), no OCI SDK dependency~/.oci/configorOCI_CLI_CONFIG_FILE), profileDEFAULTunlessconfig_file_profileis set, with missing keys inherited fromDEFAULT, as the OCI SDKs doOCI_API_KEYmarker line after the PEM blockoci-backend(addsrsaandbase64); without it, a clear "not compiled in" error, mirrorings3-backendBackendConfig::location()gives a display string, soinit,syncandimportprint the S3 and OCI cases through one path instead of per-backendmatcharms. S3 output wording changes slightly (Detected Terraform backend: s3://bucket/key (region: …))Out of scope
--state-fileworkspace_key_prefixfor non-default Terraform workspacesTest plan
state::oci: config file sections, backend attributes overriding the profile, missing-credential error, object path encoding (/in object names →%2F), PEM extraction with the console marker, key parsing, and a signature round-trip verified against the public keytest_oci_backend_block_parsedandtest_oci_backend_key_defaults_to_terraform_tfstate--no-default-features --features sqlite,s3-backendcargo fmt --all -- --checkcleancargo clippy --all-targets -- -D warnings: no new findings. Current stable clippy reports 33 pre-existingdouble_must_useerrors insrc/state/backend.rsonmainas well, untouched hereoxid initandoxid syncon a config withbackend "oci"and a console-generated API key imported the same resources asterraform state pull