github.com/ratanraj/packer@v1.3.2/website/source/docs/builders/oracle-oci.html.md (about)

     1  ---
     2  description: |
     3    The oracle-oci builder is able to create new custom images for use with Oracle
     4    Cloud Infrastructure (OCI).
     5  layout: docs
     6  page_title: 'Oracle OCI - Builders'
     7  sidebar_current: 'docs-builders-oracle-oci'
     8  ---
     9  
    10  # Oracle Cloud Infrastructure (OCI) Builder
    11  
    12  Type: `oracle-oci`
    13  
    14  The `oracle-oci` Packer builder is able to create new custom images for use
    15  with [Oracle Cloud Infrastructure](https://cloud.oracle.com) (OCI). The builder
    16  takes a base image, runs any provisioning necessary on the base image after
    17  launching it, and finally snapshots it creating a reusable custom image.
    18  
    19  It is recommended that you familiarise yourself with the
    20  [Key Concepts and Terminology](https://docs.us-phoenix-1.oraclecloud.com/Content/GSG/Concepts/concepts.htm)
    21  prior to using this builder if you have not done so already.
    22  
    23  The builder _does not_ manage images. Once it creates an image, it is up to you
    24  to use it or delete it.
    25  
    26  ## Authorization
    27  
    28  The Oracle OCI API requires that requests be signed with the RSA public key
    29  associated with your [IAM](https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/overview.htm)
    30  user account. For a comprehensive example of how to configure the required
    31  authentication see the documentation on
    32  [Required Keys and OCIDs](https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm)
    33  ([Oracle Cloud IDs](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm)).
    34  
    35  ## Configuration Reference
    36  
    37  There are many configuration options available for the `oracle-oci` builder.
    38  In addition to the options listed here, a
    39  [communicator](/docs/templates/communicator.html) can be configured for this
    40  builder.
    41  
    42  ### Required
    43  
    44   -  `availability_domain` (string) - The name of the
    45      [Availability Domain](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/regions.htm)
    46      within which a new instance is launched and provisioned.
    47      The names of the Availability Domains have a prefix that is specific to
    48      your [tenancy](https://docs.us-phoenix-1.oraclecloud.com/Content/GSG/Concepts/concepts.htm#two).
    49  
    50      To get a list of the Availability Domains, use the
    51      [ListAvailabilityDomains](https://docs.us-phoenix-1.oraclecloud.com/api/#/en/identity/latest/AvailabilityDomain/ListAvailabilityDomains)
    52      operation, which is available in the IAM Service API.
    53  
    54   -  `base_image_ocid` (string) - The OCID of the [base image](https://docs.us-phoenix-1.oraclecloud.com/Content/Compute/References/images.htm)
    55      to use. This is the unique identifier of the image that will be used to
    56      launch a new instance and provision it.
    57  
    58      To get a list of the accepted image OCIDs, use the
    59      [ListImages](https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/latest/Image/ListImages)
    60      operation available in the Core Services API.
    61  
    62   -  `compartment_ocid` (string) - The OCID of the
    63      [compartment](https://docs.us-phoenix-1.oraclecloud.com/Content/GSG/Tasks/choosingcompartments.htm)
    64  
    65   -  `fingerprint` (string) - Fingerprint for the OCI API signing key.
    66      Overrides value provided by the
    67      [OCI config file](https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/sdkconfig.htm)
    68      if present.
    69  
    70   -  `shape` (string) - The template that determines the number of
    71      CPUs, amount of memory, and other resources allocated to a newly created
    72      instance.
    73  
    74      To get a list of the available shapes, use the
    75      [ListShapes](https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Shape/ListShapes)
    76      operation available in the Core Services API.
    77  
    78   -  `subnet_ocid` (string) - The name of the subnet within which a new instance
    79      is launched and provisioned.
    80  
    81      To get a list of your subnets, use the
    82      [ListSubnets](https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/latest/Subnet/ListSubnets)
    83      operation available in the Core Services API.
    84  
    85      Note: the subnet must be configured to allow access via your chosen
    86      [communicator](/docs/templates/communicator.html) (communicator defaults to
    87      [SSH tcp/22](/docs/templates/communicator.html#ssh_port)).
    88  
    89  
    90  ### Optional
    91  
    92   -  `access_cfg_file` (string) - The path to the
    93      [OCI config file](https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/sdkconfig.htm).
    94      Defaults to `$HOME/.oci/config`.
    95  
    96   -  `access_cfg_file_account` (string) - The specific account in the
    97      [OCI config file](https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/sdkconfig.htm)
    98      to use. Defaults to `DEFAULT`.
    99  
   100   -  `image_name` (string) - The name to assign to the resulting custom image.
   101  
   102   -  `key_file` (string) - Full path and filename of the OCI API signing key.
   103      Overrides value provided by the
   104      [OCI config file](https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/sdkconfig.htm)
   105      if present.
   106  
   107   -  `pass_phrase` (string) - Pass phrase used to decrypt the OCI API signing
   108      key. Overrides value provided by the
   109      [OCI config file](https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/sdkconfig.htm)
   110      if present.
   111  
   112   -  `region` (string) - An Oracle Cloud Infrastructure region. Overrides
   113      value provided by the
   114      [OCI config file](https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/sdkconfig.htm)
   115      if present.
   116  
   117   -  `tenancy_ocid` (string) - The OCID of your tenancy. Overrides value provided
   118      by the
   119      [OCI config file](https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/sdkconfig.htm)
   120      if present.
   121  
   122   -  `user_ocid` (string) - The OCID of the user calling the OCI API. Overrides
   123      value provided by the [OCI config file](https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/sdkconfig.htm)
   124      if present.
   125  
   126   -  `use_private_ip` (boolean) - Use private ip addresses to connect to the instance via ssh.
   127  
   128   - `metadata` (map of strings) - Metadata optionally contains custom metadata key/value pairs provided in the
   129  configuration. While this can be used to set metadata["user_data"] the explicit "user_data" and "user_data_file" values will have precedence. An instance's metadata can be obtained from at http://169.254.169.254 on the
   130  launched instance.
   131  
   132   - `user_data` (string) - user_data to be used by cloud
   133     init. See [the Oracle docs](https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/LaunchInstanceDetails) for more details. Generally speaking, it is easier to use the `user_data_file`,
   134     but you can use this option to put either the plaintext data or the base64
   135     encoded data directly into your Packer config.
   136  
   137   - `user_data_file` (string) - Path to a file to be used as user_data by cloud
   138     init. See [the Oracle docs](https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/LaunchInstanceDetails) for more details. Example:
   139     `"user_data_file": "./boot_config/myscript.sh"`
   140  
   141   - `tags` (map of strings) - Add one or more freeform tags to the resulting custom image. See [the Oracle docs](https://docs.cloud.oracle.com/iaas/Content/Identity/Concepts/taggingoverview.htm) for more details. Example:
   142  
   143  ``` {.yaml}
   144  "tags":
   145    "tag1": "value1"
   146    "tag2": "value2"
   147  ```
   148  
   149  ## Basic Example
   150  
   151  Here is a basic example. Note that account specific configuration has been
   152  substituted with the letter `a` and OCIDS have been shortened for brevity.
   153  
   154  ``` json
   155  {
   156      "availability_domain": "aaaa:PHX-AD-1",
   157      "base_image_ocid": "ocid1.image.oc1.phx.aaaaaaaa5yu6pw3riqtuhxzov7fdngi4tsteganmao54nq3pyxu3hxcuzmoa",
   158      "compartment_ocid": "ocid1.compartment.oc1..aaa",
   159      "image_name": "ExampleImage",
   160      "shape": "VM.Standard1.1",
   161      "ssh_username": "opc",
   162      "subnet_ocid": "ocid1.subnet.oc1..aaa",
   163      "type": "oracle-oci"
   164  }
   165  ```