oracle.oci.oci_object_storage_bucket – Manage a Bucket resource in Oracle Cloud Infrastructure

Note

This plugin is part of the oracle.oci collection (version 4.11.0).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install oracle.oci.

To use it in a playbook, specify: oracle.oci.oci_object_storage_bucket.

New in version 2.9.0: of oracle.oci

Synopsis

  • This module allows the user to create, update and delete a Bucket resource in Oracle Cloud Infrastructure

  • For state=present, creates a bucket in the given namespace with a bucket name and optional user-defined metadata. Avoid entering confidential information in bucket names.

  • This resource has the following action operations in the oracle.oci.oci_object_storage_bucket_actions module: make_bucket_writable, reencrypt.

Requirements

The below requirements are needed on the host that executes this module.

Parameters

Parameter Choices/Defaults Comments
api_user
string
The OCID of the user, on whose behalf, OCI APIs are invoked. If not set, then the value of the OCI_USER_ID environment variable, if any, is used. This option is required if the user is not specified through a configuration file (See config_file_location). To get the user's OCID, please refer https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm.
api_user_fingerprint
string
Fingerprint for the key pair being used. If not set, then the value of the OCI_USER_FINGERPRINT environment variable, if any, is used. This option is required if the key fingerprint is not specified through a configuration file (See config_file_location). To get the key pair's fingerprint value please refer https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm.
api_user_key_file
string
Full path and filename of the private key (in PEM format). If not set, then the value of the OCI_USER_KEY_FILE variable, if any, is used. This option is required if the private key is not specified through a configuration file (See config_file_location). If the key is encrypted with a pass-phrase, the api_user_key_pass_phrase option must also be provided.
api_user_key_pass_phrase
string
Passphrase used by the key referenced in api_user_key_file, if it is encrypted. If not set, then the value of the OCI_USER_KEY_PASS_PHRASE variable, if any, is used. This option is required if the key passphrase is not specified through a configuration file (See config_file_location).
auth_purpose
string
    Choices:
  • service_principal
The auth purpose which can be used in conjunction with 'auth_type=instance_principal'. The default auth_purpose for instance_principal is None.
auth_type
string
    Choices:
  • api_key ←
  • instance_principal
  • instance_obo_user
  • resource_principal
The type of authentication to use for making API requests. By default auth_type="api_key" based authentication is performed and the API key (see api_user_key_file) in your config file will be used. If this 'auth_type' module option is not specified, the value of the OCI_ANSIBLE_AUTH_TYPE, if any, is used. Use auth_type="instance_principal" to use instance principal based authentication when running ansible playbooks within an OCI compute instance.
auto_tiering
string
Set the auto tiering status on the bucket. By default, a bucket is created with auto tiering `Disabled`. Use this option to enable auto tiering during bucket creation. Objects in a bucket with auto tiering set to `InfrequentAccess` are transitioned automatically between the 'Standard' and 'InfrequentAccess' tiers based on the access pattern of the objects.
This parameter is updatable.
cert_bundle
string
The full path to a CA certificate bundle to be used for SSL verification. This will override the default CA certificate bundle. If not set, then the value of the OCI_ANSIBLE_CERT_BUNDLE variable, if any, is used.
compartment_id
string
The ID of the compartment in which to create the bucket.
Required for create using state=present.
This parameter is updatable.
config_file_location
string
Path to configuration file. If not set then the value of the OCI_CONFIG_FILE environment variable, if any, is used. Otherwise, defaults to ~/.oci/config.
config_profile_name
string
The profile to load from the config file referenced by config_file_location. If not set, then the value of the OCI_CONFIG_PROFILE environment variable, if any, is used. Otherwise, defaults to the "DEFAULT" profile in config_file_location.
defined_tags
dictionary
Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: `{"Operations": {"CostCenter": "42"}}`
This parameter is updatable.
force
boolean
    Choices:
  • no
  • yes
Default:
"false"
Force delete a bucket along with all the objects contained in it. Use with (state=absent).
force_create
boolean
    Choices:
  • no ←
  • yes
Whether to attempt non-idempotent creation of a resource. By default, create resource is an idempotent operation, and doesn't create the resource if it already exists. Setting this option to true, forcefully creates a copy of the resource, even if it already exists.This option is mutually exclusive with key_by.
freeform_tags
dictionary
Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: `{"Department": "Finance"}`
This parameter is updatable.
key_by
list / elements=string
The list of attributes of this resource which should be used to uniquely identify an instance of the resource. By default, all the attributes of a resource are used to uniquely identify a resource.
kms_key_id
string
The OCID of a master encryption key used to call the Key Management service to generate a data encryption key or to encrypt or decrypt a data encryption key.
This parameter is updatable.
metadata
dictionary
Arbitrary string, up to 4KB, of keys and values for user-defined metadata.
This parameter is updatable.
name
string / required
The name of the bucket. Valid characters are uppercase or lowercase letters, numbers, hyphens, underscores, and periods. Bucket names must be unique within an Object Storage namespace. Avoid entering confidential information. example: Example: my-new-bucket1
namespace_name
string / required
The Object Storage namespace used for the request.
object_events_enabled
boolean
    Choices:
  • no
  • yes
Whether or not events are emitted for object state changes in this bucket. By default, `objectEventsEnabled` is set to `false`. Set `objectEventsEnabled` to `true` to emit events for object state changes. For more information about events, see Overview of Events.
This parameter is updatable.
public_access_type
string
    Choices:
  • NoPublicAccess
  • ObjectRead
  • ObjectReadWithoutList
The type of public access enabled on this bucket. A bucket is set to `NoPublicAccess` by default, which only allows an authenticated caller to access the bucket and its contents. When `ObjectRead` is enabled on the bucket, public access is allowed for the `GetObject`, `HeadObject`, and `ListObjects` operations. When `ObjectReadWithoutList` is enabled on the bucket, public access is allowed for the `GetObject` and `HeadObject` operations.
This parameter is updatable.
region
string
The Oracle Cloud Infrastructure region to use for all OCI API requests. If not set, then the value of the OCI_REGION variable, if any, is used. This option is required if the region is not specified through a configuration file (See config_file_location). Please refer to https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/regions.htm for more information on OCI regions.
state
string
    Choices:
  • present ←
  • absent
The state of the Bucket.
Use state=present to create or update a Bucket.
Use state=absent to delete a Bucket.
storage_tier
string
    Choices:
  • Standard
  • Archive
The type of storage tier of this bucket. A bucket is set to 'Standard' tier by default, which means the bucket will be put in the standard storage tier. When 'Archive' tier type is set explicitly, the bucket is put in the Archive Storage tier. The 'storageTier' property is immutable after bucket is created.
tenancy
string
OCID of your tenancy. If not set, then the value of the OCI_TENANCY variable, if any, is used. This option is required if the tenancy OCID is not specified through a configuration file (See config_file_location). To get the tenancy OCID, please refer https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm
versioning
string
    Choices:
  • Enabled
  • Disabled
  • Suspended
Set the versioning status on the bucket. By default, a bucket is created with versioning `Disabled`. Use this option to enable versioning during bucket creation. Objects in a version enabled bucket are protected from overwrites and deletions. Previous versions of the same object will be available in the bucket.
This parameter is updatable.

Examples

- name: Create bucket
  oci_object_storage_bucket:
    # required
    compartment_id: "ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx"
    namespace_name: namespace_name_example
    name: name_example

    # optional
    storage_tier: Standard
    metadata: null
    public_access_type: NoPublicAccess
    object_events_enabled: true
    freeform_tags: {'Department': 'Finance'}
    defined_tags: {'Operations': {'CostCenter': 'US'}}
    kms_key_id: "ocid1.kmskey.oc1..xxxxxxEXAMPLExxxxxx"
    versioning: Enabled
    auto_tiering: auto_tiering_example

- name: Update bucket
  oci_object_storage_bucket:
    # required
    namespace_name: namespace_name_example
    name: name_example

    # optional
    compartment_id: "ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx"
    metadata: null
    public_access_type: NoPublicAccess
    object_events_enabled: true
    freeform_tags: {'Department': 'Finance'}
    defined_tags: {'Operations': {'CostCenter': 'US'}}
    kms_key_id: "ocid1.kmskey.oc1..xxxxxxEXAMPLExxxxxx"
    versioning: Enabled
    auto_tiering: auto_tiering_example

- name: Delete bucket
  oci_object_storage_bucket:
    # required
    namespace_name: namespace_name_example
    name: name_example
    state: absent

    # optional
    force: false

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
bucket
complex
on success
Details of the Bucket resource acted upon by the current operation

Sample:
{'approximate_count': 56, 'approximate_size': 56, 'auto_tiering': 'Disabled', 'compartment_id': 'ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx', 'created_by': 'created_by_example', 'defined_tags': {'Operations': {'CostCenter': 'US'}}, 'etag': 'etag_example', 'freeform_tags': {'Department': 'Finance'}, 'id': 'ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx', 'is_read_only': True, 'kms_key_id': 'ocid1.kmskey.oc1..xxxxxxEXAMPLExxxxxx', 'metadata': {}, 'name': 'name_example', 'namespace': 'namespace_example', 'object_events_enabled': True, 'object_lifecycle_policy_etag': 'object_lifecycle_policy_etag_example', 'public_access_type': 'NoPublicAccess', 'replication_enabled': True, 'storage_tier': 'Standard', 'time_created': '2013-10-20T19:20:30+01:00', 'versioning': 'Enabled'}
 
approximate_count
integer
on success
The approximate number of objects in the bucket. Count statistics are reported periodically. You will see a lag between what is displayed and the actual object count.

Sample:
56
 
approximate_size
integer
on success
The approximate total size in bytes of all objects in the bucket. Size statistics are reported periodically. You will see a lag between what is displayed and the actual size of the bucket.

Sample:
56
 
auto_tiering
string
on success
The auto tiering status on the bucket. A bucket is created with auto tiering `Disabled` by default. For auto tiering `InfrequentAccess`, objects are transitioned automatically between the 'Standard' and 'InfrequentAccess' tiers based on the access pattern of the objects.

Sample:
Disabled
 
compartment_id
string
on success
The compartment ID in which the bucket is authorized.

Sample:
ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx
 
created_by
string
on success
The OCID of the user who created the bucket.

Sample:
created_by_example
 
defined_tags
dictionary
on success
Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: `{"Operations": {"CostCenter": "42"}}`

Sample:
{'Operations': {'CostCenter': 'US'}}
 
etag
string
on success
The entity tag (ETag) for the bucket.

Sample:
etag_example
 
freeform_tags
dictionary
on success
Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: `{"Department": "Finance"}`

Sample:
{'Department': 'Finance'}
 
id
string
on success
The OCID of the bucket.

Sample:
ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx
 
is_read_only
boolean
on success
Whether or not this bucket is read only. By default, `isReadOnly` is set to `false`. This will be set to 'true' when this bucket is configured as a destination in a replication policy.

Sample:
True
 
kms_key_id
string
on success
The OCID of a master encryption key used to call the Key Management service to generate a data encryption key or to encrypt or decrypt a data encryption key.

Sample:
ocid1.kmskey.oc1..xxxxxxEXAMPLExxxxxx
 
metadata
dictionary
on success
Arbitrary string keys and values for user-defined metadata.

 
name
string
on success
The name of the bucket. Avoid entering confidential information. Example: my-new-bucket1

Sample:
name_example
 
namespace
string
on success
The Object Storage namespace in which the bucket resides.

Sample:
namespace_example
 
object_events_enabled
boolean
on success
Whether or not events are emitted for object state changes in this bucket. By default, `objectEventsEnabled` is set to `false`. Set `objectEventsEnabled` to `true` to emit events for object state changes. For more information about events, see Overview of Events.

Sample:
True
 
object_lifecycle_policy_etag
string
on success
The entity tag (ETag) for the live object lifecycle policy on the bucket.

Sample:
object_lifecycle_policy_etag_example
 
public_access_type
string
on success
The type of public access enabled on this bucket. A bucket is set to `NoPublicAccess` by default, which only allows an authenticated caller to access the bucket and its contents. When `ObjectRead` is enabled on the bucket, public access is allowed for the `GetObject`, `HeadObject`, and `ListObjects` operations. When `ObjectReadWithoutList` is enabled on the bucket, public access is allowed for the `GetObject` and `HeadObject` operations.

Sample:
NoPublicAccess
 
replication_enabled
boolean
on success
Whether or not this bucket is a replication source. By default, `replicationEnabled` is set to `false`. This will be set to 'true' when you create a replication policy for the bucket.

Sample:
True
 
storage_tier
string
on success
The storage tier type assigned to the bucket. A bucket is set to `Standard` tier by default, which means objects uploaded or copied to the bucket will be in the standard storage tier. When the `Archive` tier type is set explicitly for a bucket, objects uploaded or copied to the bucket will be stored in archive storage. The `storageTier` property is immutable after bucket is created.

Sample:
Standard
 
time_created
string
on success
The date and time the bucket was created, as described in RFC 2616.

Sample:
2013-10-20T19:20:30+01:00
 
versioning
string
on success
The versioning status on the bucket. A bucket is created with versioning `Disabled` by default. For versioning `Enabled`, objects are protected from overwrites and deletes, by maintaining their version history. When versioning is `Suspended`, the previous versions will still remain but new versions will no longer be created when overwitten or deleted.

Sample:
Enabled


Authors

  • Oracle (@oracle)