Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get latest image OCID dynamically #78

Open
kral2 opened this issue Oct 9, 2021 · 0 comments
Open

get latest image OCID dynamically #78

kral2 opened this issue Oct 9, 2021 · 0 comments
Labels
enhancement New feature or request
Milestone

Comments

@kral2
Copy link
Contributor

kral2 commented Oct 9, 2021

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Sometimes we just want to launch an instance with the latest available image for a particular operating system, without having to check the exact OCID for each region on OCI Images documentation

Module user should be able to just indicate something like this: "use latest Oracle Linux 7.9 image matching my shape and region".

Additionally, we could potentially make the retrieved image OCID permanent so a recreate is not triggered when a newer version is available.

New or Affected Resource(s)

oci_core_instance for the source_id Input Variable.

Potential Terraform Configuration

We need to define a data source, similar to the one below:

data "oci_core_images" "images" {
    #Required
    compartment_id = var.compartment_id

    #Optional
    # display_name = var.image_display_name
    operating_system = "Oracle Linux"
    operating_system_version = "7.9"
    shape = var.shape
    sort_by = "TIMECREATED"
    sort_order = "DESC"
}

Then, we can target the image ocid with this expression:

data.oci_core_images.images.images[0].id

References

Data source: oci_core_images
OCI Images OCIDs reference

@kral2 kral2 added the enhancement New feature or request label Oct 9, 2021
@kral2 kral2 added this to the Future milestone Oct 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant