Managing custom images
After you import a custom image to IBM Cloud VPC, you can view details about the image, manage the lifecycle of the image, use the image to create a virtual server instance, export the image, and even share it with a private catalog.
To manage an image from volume, see Managing image from volume. To use a custom image in a private catalog, see Onboarding a virtual server image for VPC.
IBM Cloud® Identity and Access Management (IAM) enables you to securely authenticate users for platform services and control access to resources consistently across IBM Cloud. For more information about access requirements for custom images, see the IAM roles and actions information in Image Service for VPC.
For details about the $vpc_api_endpoint
and $iam_token
variables in the following examples, see the Authentication and Endpoint URLs sections in Virtual Private Cloud API Introduction.
Managing custom images by using the UI
You can manage an image by using the IBM Cloud console.
- In IBM Cloud console, go to Navigation Menu icon > Infrastructure > Compute > Images.
- On the Custom images tab, click the Actions icon for a specific image and select from the available options. Encrypted custom images are identified by a lock icon after the image name. You can select from the following actions:
Action | Description |
---|---|
Rename | Rename the custom image. |
Create virtual server instance | Create a new virtual server from the custom image. |
Export | Copy the custom image to IBM Cloud Object Storage. |
Share to catalog | Share the IBM Cloud VPC custom image to an existing private catalog. |
Copy | Copy the UUID of the custom image. |
View checksum | View the checksum for the custom image. |
Schedule lifecycle | Opens the Schedule image lifecycle panel. You can make an immediate status change or schedule a statue change for a future date and time. You can schedule a single status change or schedule the complete lifecycle of the
images. The image statuses are:
You can move back and forth between the three statuses. Only the statuses you can change to are displayed. You can schedule status changes by using calendar date and time or number of days. The obsolescence dates must always be after the deprecation date. |
Delete | Delete the custom image.
If you want to delete a custom image in a private catalog, see Deleting a custom image in a private catalog. |
Listing custom images by using the CLI
You can list all of the IBM Cloud VPC custom images in your region by using the command-line interface (CLI).
To list all custom images by using the CLI, use the ibmcloud is images
command. Custom images are private to the account where they are created, so the --visibility
option is private
.
ibmcloud is images --visibility private
For more information, see ibmcloud is images in the VPC CLI reference page.
Listing all images by using the API
You can list all of the IBM Cloud VPC images in your region by using the application programming interface (API).
To list all images by using the API, use List all images. Custom images are private to the account where they are created, so you can set the visibility
property to private
to retrieve only custom images.
curl -X GET \
”$vpc_api_endpoint/v1/images?version=2022-11-21&generation=2" \
-H "Authorization: Bearer $iam_token"
Listing all images by using Terraform
You can list all of the IBM Cloud VPC images in your region by using Terraform.
To list all images by using Terraform, use the Terraform data source command ibm_is_images. Custom images
are private to the account where they are created, so you can set the visibility
attribute to private
to retrieve only custom images.
data "ibm_is_images" "images" {
visibility = "public"
}
Viewing custom image details by using the UI
You can view the following details of a custom image:
- Name and ID
- Assigned resource group
- Size
- Location
- Creation date
- Operating system and version
- Encryption type
- Deprecation date (if set)
- Obsolescence date (if set)
You can edit the name of the custom image, adds tags for searchability, and view and copy the unique Cloud Resource Name (CRN). The SHA256 checksum value for the image is accessible.
To view details for a custom image, complete the following steps.
- In IBM Cloud console, go to Navigation Menu icon > Infrastructure > Compute > Images.
- On the Custom images tab, click the name of a custom image to view details about that image.
- On the Image details page you can edit the name of the image, add tags, and copy the CRN for the image.
- From the Actions menu of the Image details page, you can create a virtual server instance from the custom image or deleting the image. For a full list of possible actions, see Managing custom images by using the UI.
Viewing custom image details by using the CLI
You can view the details of a custom image, such as name and ID, operating system and version, encryption status, deprecation or obsolescence dates, and assigned resource group, by using the command-line interface (CLI).
To view the details of a custom image by using the CLI, use the ibmcloud is image
command. Specify the name or ID of the custom image with the IMAGE
variable.
ibmcloud is image IMAGE
For more information, see ibmcloud is image in the VPC CLI reference page.
Retrieving custom image details by using the API
You can view the details of a custom image, such as name and ID, operating system and version, encryption status, deprecation or obsolescence dates, and assigned resource group, by using the application programming interface (API).
To retrieve the details of a specific custom image by using the API, use Retrieve an image. For the $image_id
variable, specify the ID of the custom image that you want to retrieve.
curl -X GET \
”$vpc_api_endpoint/v1/images/$image_id?version=2022-11-21&generation=2" \
-H "Authorization: Bearer $iam_token"
Retrieving custom image details by using Terraform
You can view the details of a custom image, such as name and ID, operating system and version, encryption status, deprecation or obsolescence dates, and assigned resource group, by using Terraform.
To view the details of an image by using Terraform, use the Terraform data source command ibm_is_images.
For the name
variable, specify the name of the custom image that you want to retrieve.
data "ibm_is_images" "image_name" {
}
Exporting a custom image to IBM Cloud Object Storage
You can export a custom image to IBM Cloud Object Storage. Later, you might want to copy the image to a new region by importing it again, or you might want to extract the image outside of VPC for use in a different location, such as on premises. Charges might be incurred for storing images in IBM Cloud Object Storage. For more information, see Billing.
Prerequisites
To export a custom image, you must meet the following prerequisites:
- You need an IAM role that includes the
is.image.image.export
andis.image.image.operate
actions. For more information, see Managing IAM access for VPC Infrastructure Services. - You need an IBM Cloud Object Storage service instance created. You must also create an authorization for the Image Service for VPC to access IBM Cloud Object Storage with the Writer service access role. For more information, see Granting access to IBM Cloud Object Storage to import and export images.
- You need IAM access to write to the bucket where you plan to export an image. For more information, see Assigning access to an individual bucket.
If the image that is being exported is deleted while an export job is in progress, the image status is set to deleting
. The export job is allowed to complete before deletion of the image completes. When the image deletion is complete,
its export job history is not available. You can use Activity Tracker events for the export job to determine its final status.
Exporting a custom image by using the UI
To export a custom image to IBM Cloud Object Storage, complete the following steps.
- In IBM Cloud console, go to Navigation Menu icon > Infrastructure > Compute > Images.
- On the Custom images tab, click the name of the custom image that you want to export.
- On the image details page, click the Actions menu and select Export.
- On the Export custom image panel, you can optionally specify a name for the export job. The name is used, along with the image name, to construct the name of the exported object in IBM Cloud Object Storage. If you do not specify a name, a name is automatically generated.
- Select the file format for exporting. Valid file formats are QCOW2 and VHD. If the custom image is an encrypted image, QCOW2 format is required.
- Specify the IBM Cloud Object Storage service instance and bucket where you want to export the custom image. Alternatively you can specify the CRN for the IBM Cloud Object Storage bucket where you want to export the image.
- Click Export custom image.
Exporting a custom image by using the CLI
You can export an IBM Cloud VPC custom image to IBM Cloud Object Storage by using the command-line interface (CLI).
To export a custom image by using the CLI, use the ibmcloud is image-export-job-create command. Specify the name or ID of the custom image to export by using the IMAGE
variable. You can specify a name for the
export job with NEW_NAME
. You can also specify the file format for exporting the image, either qcow2
or vhd
. The qcow2
format is the default file format and is the required format if the
custom image is encrypted. Additionally, specify the IBM Cloud Object Storage BUCKET
where you want to export the custom image.
ibmcloud is image-export-job-create IMAGE [--name NEW_NAME] [--format qcow2 | vhd] --bucket BUCKET
The following example exports a custom image with the ID of 72251a2e-d6c5-42b4-97b0-b5f8e8d1f479
. The export job is named my-export-job
. The file format for exporting the image is qcow2
. The IBM Cloud
Object Storage bucket where the image exported is named my-bucket
.
ibmcloud is image-export-job-create 72251a2e-d6c5-42b4-97b0-b5f8e8d1f479 --name my-export-job --format qcow2 --bucket my-bucket
For more information, see ibmcloud is image-export-job-create in the VPC CLI reference page.
Exporting a custom image with the API
You can export an IBM Cloud VPC custom image to IBM Cloud Object Storage by using the application programming interface (API).
To export a custom image by using the API, use Create an image export job.
For the$image_id
variable, specify the ID of the custom image that you want to export. You can optionally specify a meaningful name
for the image export job. In this example, the export job name is my-image-export
.
For the storage_bucket
name
subproperty, specify the name of the IBM Cloud Object Storage bucket where you want to export the custom image. In this example, the bucket name is bucket-27200-lwx4cfvcue
.
Alternatively, you can use the crn
subproperty to specify the CRN of the bucket.
curl -X POST \
"$vpc_api_endpoint/v1/images/$image_id/export_jobs?version=2022-11-21&generation=2" \
-H "Authorization: Bearer $iam_token" \
-d '{
"name": "my-image-export",
"storage_bucket": {
"name": "bucket-27200-lwx4cfvcue"
}
}'
Viewing and managing custom image export history
You can view the custom image export history to see details such as the export job name, status, target bucket in IBM Cloud Object Storage, the IBM Cloud Object Storage object name that is assigned, the date that the export job started, and if the export job is complete, the completion date.
You can also delete a completed image export job. Or you can delete (and cancel) an in-progress image export job if you have an IAM role that includes the is.image.image.export
action.
When you delete an image export job, it is removed only from the export history. The exported image file is not removed from the IBM Cloud Object Storage bucket. You must manage files that are stored in IBM Cloud Object Storage by using the IBM Cloud Object Storage interfaces.
Finally, you can rename an image export job. Renaming the image export job does not change the name of the object that is created in IBM Cloud Object Storage.
Limits for image export jobs
The following limits exist for image export jobs:
- Five active export job requests per image
- Ten total export jobs per image
- Twenty active export jobs per account per region
Viewing custom image export history by using the UI
To view the export history of a custom image, complete the following steps.
- In IBM Cloud console, go to Navigation Menu icon > Infrastructure > Compute > Images.
- On the Custom images tab, click the name of a custom image to view details about that image.
- On the Image details page, click the Export history tab.
Deleting or canceling an image export job by using the UI
To delete a completed image export job or cancel (and delete) an in-progress image export job, complete the following steps.
- On the image details page, click the Export history tab.
- For the export job that you want to delete or cancel, click the Actions icon and select Delete.
Renaming an image export job by using the UI
To rename an image export job, complete the following steps.
- On the image details page, click the Export history tab.
- For the export job that you want to rename, click the Actions icon and select Rename.
Viewing custom image export history by using the CLI
To view the export history of a specific custom image by using the CLI, use the ibmcloud is image-export-jobs command. Specify the name or ID of the custom image that was exported by using the IMAGE
variable.
ibmcloud is image-export-jobs IMAGE
The following example shows the export job history for a custom image with the ID of 72251a2e-d6c5-42b4-97b0-b5f8e8d1f479
.
ibmcloud is image-export-jobs 72251a2e-d6c5-42b4-97b0-b5f8e8d1f479
For more information, see ibmcloud is image-export-jobs in the VPC CLI reference page.
Viewing image export job details by using the CLI
To view the details of a specific image export job by using the CLI, use the ibmcloud is image-export-job
command. Specify the name or ID of the custom image that was exported by using the IMAGE
variable.
Specify the name or ID of the image export job by using the JOB
variable.
ibmcloud is image-export-job IMAGE JOB
For more information, see ibmcloud is image-export-job in the VPC CLI reference page.
Deleting or canceling an image export job by using the CLI
To delete a completed image export job or cancel (and delete) an in-progress image export job, use the ibmcloud is image-export-job-delete
command. Specify the name or ID of the custom image that was exported
by using the IMAGE
variable. Specify the name or ID of the image export job by using the JOB
variable.
ibmcloud is image-export-job-delete IMAGE JOB
For more information, see ibmcloud is image-export-job-delete in the VPC CLI reference page.
Renaming an image export job by using the CLI
To rename a custom image export job by using the CLI, use the ibmcloud is image-export-job-update
command. Specify the name or ID of the custom image that was exported by using the IMAGE
variable.
Specify the name or ID of the image export job by using the JOB
variable. Specify the new name that you want to assign to the image export job by using the NAME
variable.
ibmcloud is image-export-job-update IMAGE JOB --name NAME
For more information, see ibmcloud is image-export-job-update in the VPC CLI reference page.
Viewing custom image export history by using the API
To view the export history of a specific custom image by using the API, use List all image export jobs.
For the$image_id
variable, specify the ID of the custom image for which you want to display export jobs.
curl -X GET \
"$vpc_api_endpoint/v1/images/$image_id/export_jobs?version=2022-11-21&generation=2" \
-H "Authorization: Bearer $iam_token"
Viewing image export job details by using the API
To view the details of a specific image export job by using the API, use Retrieve an image export job.
For the$image_id
variable, specify the ID of the custom image that was exported. For the $export_job_id
variable, specify the ID of the image export job for which you want to retrieve details.
curl -X GET \
"$vpc_api_endpoint/v1/images/$image_id/export_jobs/$export_job_id?version=2022-11-21&generation=2" \
-H "Authorization: Bearer $iam_token"
Deleting or canceling an image export job by using the API
To delete a completed image export job or cancel (and delete) an in-progress image export job by using the API, use Delete an image export job.
For the$image_id
variable, specify the ID of the custom image for which you want to delete an export job. For the $export_job_id
variable, specify the ID of the image export job that you want to delete.
curl -X DELETE \
"$vpc_api_endpoint/v1/images/$image_id/export_jobs/$export_job_id?version=2022-11-21&generation=2" \
-H "Authorization: Bearer $iam_token"
Renaming an image export job by using the API
To rename a custom image export job by using the API, use Update an image export job.
For the$image_id
variable, specify the ID of the custom image for which you want to rename an export job. For the $export_job_id
variable, specify the ID of the image export job that you want to rename. The new name
to assign to the image export job in the following example is my-export-job-patched
.
curl -X PATCH \
"$vpc_api_endpoint/v1/images/$image_id/export_jobs/$export_job_id?version=2022-11-21&generation=2" \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $iam_token" \
-d '{
"name": "my-export-job-patched"
}'
Sharing a custom image to a private catalog by using the UI
You can share an existing IBM Cloud VPC custom image to an existing private catalog. If you don't already have a private catalog, see Onboarding a virtual server image for VPC.
The Share image to private catalog action is not available for the following images:
- The image is already shared with a private catalog. An image in a private catalog can exist in only one version within one product offering in one private catalog. You must remove the image from the version it is in first before that image can be shared in a different version.
- The image is encrypted.
- The image is not an x86 image.
To share a custom image to a private catalog, complete the following steps.
- In IBM Cloud console, go to Navigation Menu icon > Infrastructure > Compute > Images.
- On the Custom images tab, click the Actions icon and select Share to catalog.
- On the Share image to private catalog page, select a Private catalog from the list of available private catalogs.
- Enter a version number in Software version.
- Click Create catalog offering to share the image to the private catalog.
- After the image is created, click Validate image.
This process shares only the custom image to the private catalog. The validation process occurs within the private catalog. Clicking Validate image takes you to a new page and from this screen, you can start with Step 3: Validate the virtual server image in Onboarding a virtual server image for VPC to complete the validation process.
Sharing a custom image to a private catalog by using the CLI
You can only share a custom image to a private catalog from IBM Cloud VPC by using the UI. For more information about onboarding to a private catalog using the CLI, see Onboarding software to your account.
Sharing a custom image to a private catalog by using the API
You can only share a custom image to a private catalog from IBM Cloud VPC by using the UI. For more information about onboarding to a private catalog using the API, see Onboarding software to your account.
Sharing a custom image to a private catalog by using Terraform
You can only share a custom image to a private catalog from IBM Cloud VPC by using the UI. For more information about onboarding to a private catalog using the Terraform, see Onboarding software to your account.
Schedule a custom image lifecycle status change in the UI
You can schedule either a single image lifecycle status change or schedule the status changes for the entire lifecycle of the image. You can make an immediate status change only if you didn't schedule a future status change.
Follow these steps to schedule a single status change:
You can schedule a single status change for an image.
- In IBM Cloud console, go to Navigation Menu icon > Infrastructure > Compute > Images.
- On the Custom images tab, click the Actions icon for a specific image and select from the available options.
- Select Schedule lifecycle.
- In Image status, select the status change for the image.
- In Deprecation details, select whether to change status Immediately or to Schedule future date.
- If you selected Schedule future date, you need to fill out the following:
- Select either By calendar date or By number of days.
- If you selected By calendar date, enter the date and time information. This is the date and time when the status change will occur.
- If you selected By number of days, put in the number of days that will pass before the status is changed.
- Select either By calendar date or By number of days.
- Click Save.
Follow these steps to schedule the entire lifecycle of the image:
You can schedule the complete lifecycle for the image. The image is first deprecated and then changes to obsolete according to the schedule that you define. Use the following steps to schedule a lifecycle change.
-
In IBM Cloud console, go to Navigation Menu icon > Infrastructure > Compute > Images.
-
On the Custom images tab, click the Actions icon for a specific image and select from the available options.
-
Select Schedule lifecycle.
-
Select Schedule complete lifecycle.
- If you selected By calendar date, enter the date and time for when you want the status change occur.
- If you selected By number of days, put in the number of days that you want to pass before the status is changed.
The date for obsolescence must be after the deprecation date.
-
Click Schedule.
Change the custom image lifecycle status by using the CLI
You can change the lifecycle status of an IBM Cloud VPC custom image by using the command-line interface (CLI). You can make an immediate status change by using the ibmcloud is image-deprecate or ibmcloud is image-obsolete commands. You can also schedule these status changes for a future date and time by using the ibmcloud is image-update command. Specify the name or ID of the custom image with the IMAGE
variable.
To make an immediate status change, use one of the following examples.
You can make an immediate status change only if a future status change is not scheduled. To remove a scheduled status change, see Remove a scheduled custom image lifecycle status change by using the CLI. After you remove the scheduled status change, you can make an immediate status change.
-
Change the image lifecycle status to
deprecate
.ibmcloud is image-deprecate IMAGE
-
Change the image lifecycle status to
obsolete
.ibmcloud is image-obsolete IMAGE
To schedule a status change, use the following example.
For the deprecate-at
or obsolete-at
option, specify a date in the ISO 8601 (YYYY-MM-DDThh:mm:ss+hh:mm
) date and time format.
YYYY
is the four digit yearMM
is the two digit monthDD
is the two digit dayT
separates the date and time informationhh
is the two digit hoursmm
is the two digit minutes+hh:mm
or-hh:mm
is the UTC time zone
Thus, the date of 30 September 2023 at 8:00 PM in the North American Central Standard Time Zone (CST) would be 2023-09-30T20:00:00-06:00
When scheduling the date and time, you can't use your current date and time. For example, if it is 8:00 AM on June 12, then the scheduled date and time must be after 8:00 AM on June 12. If you define both the deprecate-at
and obsolete-at
dates, the obsolete-at
date must be after the deprecate-at
date.
ibmcloud is image-update IMAGE [--deprecate-at YYYY-MM-DDThh:mm:ss+hh:mm] [--obsolete-at YYYY-MM-DDThh:mm:ss+hh:mm]
If you want to change the deprecate-at
and obsolete-at
date and time entries, you can run these commands again. The previous dates and times are then replaced with the new dates and times.
Remove a previously scheduled custom image lifecycle status change by using the CLI
You can remove a scheduled status change by using the --reset-deprecate-at
or --reset-obsolete-at
options. If you use either of these options with the ibmcloud is image-update command, the date and
time are removed from the image. The image is no longer scheduled for that status change.
ibmcloud is image-update IMAGE [--reset-deprecate-at] [--reset-obsolete-at]
If you use both the --reset-deprecate-at
and --reset-obsolete-at
options, the image status returns to available
.
Change the custom image lifecycle status by using the API
You can change the lifecycle status of an IBM Cloud VPC custom image by using the application programming interface (API). You can make an immediate status change or schedule a status change to happen later.
To make an immediate status change, use one of the following examples. For the$image_id
variable, specify the ID of the custom image for the status change.
You can make an immediate status change only if a future status change is not scheduled. To remove a scheduled status change, see Remove a scheduled custom image lifecycle status change by using the API. After you remove the scheduled status change, you can make an immediate status change.
-
Change image lifecycle status to
deprecated
.curl -X POST "$vpc_api_endpoint/v1/images/$image_id/deprecate?version=2023-02-21&generation=2" -H “Authorization: Bearer $iam_token”
-
Change the image lifecycle status to
obsolete
.curl -X POST "$vpc_api_endpoint/v1/images/$image_id/obsolete?version=2023-12-21&generation=2" -H “Authorization: Bearer $iam_token”
To schedule a status change, use one of the following examples.
For the deprecation_at
or obsolescence_at
properties, specify a date in the ISO 8601 (YYYY-MM-DDThh:mm:ss+hh:mm
) date and time format.
YYYY
is the four digit yearMM
is the two digit monthDD
is the two digit dayT
separates the date and time informationhh
is the two digit hoursmm
is the two digit minutes+hh:mm
or-hh:mm
is the UTC time zone
Thus, the date of 30 September 2023 at 8:00 PM in the North American Central Standard Time Zone (CST) would be 2023-09-30T20:00:00-06:00
When scheduling the date and time, you can't use your current date and time. For example, if it is 8:00 AM on June 12, then the scheduled date and time must be after 8:00 AM on June 12. If you define both the deprecation_at
and
obsolescence_at
dates and times, the obsolescence_at
date must be after the deprecation_at
date and time.
-
Schedule a status change to
deprecated
.curl -X PATCH "$vpc_api_endpoint/v1/images/$image_id?version=2022-11-21&generation=2" -H "Authorization: Bearer $iam_token" -d '{ "deprecation_at": "2023-03-01T06:11:28+05:30" }'
-
Schedule a status change to
obsolete
.curl -X PATCH "$vpc_api_endpoint/v1/images/$image_id?version=2022-11-21&generation=2" -H "Authorization: Bearer $iam_token" -d '{ “obsolescence_at": "2023-12-31T06:11:28+05:30" }'
If you want to change the
deprecation_at
andobsolescence_at
date and time entries, you can run these commands again. The previous dates and times are replaced with the new dates and times.
Remove previously scheduled custom image lifecycle status by using the API
Make a PATCH /images
request to remove any scheduled status change by updating deprecation_at
or obsolescence_at
to null
. This property change removes the date and time from the image and the
image is no longer scheduled for that status change.
-
To change an image from
deprecated
toavailable
, change thedeprecation_at
property tonull
.curl -X PATCH "$vpc_api_endpoint/v1/images/$image_id?version=2022-11-21&generation=2" -H "Authorization: Bearer $iam_token" -d '{ "deprecation_at": null }'
-
To change an image from
obsolete
to its previous state, changeobsolescence_at
tonull
. If the image previously contained a value other thannull
fordeprecation_at
, then this property change removes theobsolete
state and changes it back todeprecated
. If the previous state wasavailable
, meaning the image was moved fromavailable
directly toobsolete
, then this property change moves fromobsolete
back toavailable
.curl -X PATCH "$vpc_api_endpoint/v1/images/$image_id?version=2022-11-21&generation=2" -H "Authorization: Bearer $iam_token" -d '{ “obsolescence_at": null }'
-
To change an image that has both the
deprecation_at
orobsolescence_at
properties set back toavailable
, you must update both thedeprecation_at
orobsolescence_at
properties.curl -X PATCH "$vpc_api_endpoint/v1/images/$image_id?version=2022-11-21&generation=2" -H "Authorization: Bearer $iam_token" -d '{ "deprecation_at": null, “obsolescence_at": null }'
Change the custom image lifecycle status using Terraform
To make an immediate status change using Terraform, use the ibm_is_image_deprecate
or
ibm_is_image_obsolete
resource commands. use one of the following examples. For the name
variable, specify the name of the custom image for the status change.
You can make an immediate status change only if a future status change is not scheduled. To remove a scheduled status change, see Remove a scheduled custom image lifecycle status change by using Terraform. After you remove the scheduled status change, you can make an immediate status change.
-
Change image lifecycle status to
deprecated
.resource "ibm_is_image" "example" { name = "example-image" href = "cos://us-south/buckettesttest/livecd.ubuntu-cpc.azure.vhd" operating_system = "ubuntu-16-04-amd64" encrypted_data_key = "eJxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0=" encryption_key = "crn:v1:bluemix:public:kms:us-south:a/6xxxxxxxxxxxxxxx:xxxxxxx-xxxx-xxxx-xxxxxxx:key:dxxxxxx-fxxx-4xxx-9xxx-7xxxxxxxx" } resource "ibm_is_image_deprecate" "example" { image = ibm_is_image.example.id }
-
Change the image lifecycle status to
obsolete
.resource "ibm_is_image" "example" { name = "example-image" href = "cos://us-south/buckettesttest/livecd.ubuntu-cpc.azure.vhd" operating_system = "ubuntu-16-04-amd64" encrypted_data_key = "eJxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0=" encryption_key = "crn:v1:bluemix:public:kms:us-south:a/6xxxxxxxxxxxxxxx:xxxxxxx-xxxx-xxxx-xxxxxxx:key:dxxxxxx-fxxx-4xxx-9xxx-7xxxxxxxx" } resource "ibm_is_image_obsolete" "example" { image = ibm_is_image.example.id }
To schedule a status change, use one of the following examples.
For the deprecation_at
or obsolescence_at
attribute, specify a date in the ISO 8601 (YYYY-MM-DDThh:mm:ss+hh:mm
) date and time format.
YYYY
is the four digit yearMM
is the two digit monthDD
is the two digit dayT
separates the date and time informationhh
is the two digit hoursmm
is the two digit minutes+hh:mm
or-hh:mm
is the UTC time zone
Thus, the date of 30 September 2023 at 8:00 PM in the North American Central Standard Time Zone (CST) would be 2023-09-30T20:00:00-06:00
When scheduling the date and time, you can't use your current date and time. For example, if it is 8:00 AM on June 12, then the scheduled date and time must be after 8:00 AM on June 12. If you define both the deprecation_at
and
obsolescence_at
dates and times, the obsolescence_at
date must be after the deprecation_at
date and time.
-
Schedule a status change to
deprecated
.resource "ibm_is_image" "example" { name = "example-image" href = "cos://us-south/buckettesttest/livecd.ubuntu-cpc.azure.vhd" operating_system = "ubuntu-16-04-amd64" deprecation_at = "2023-11-28T15:10:00.000Z" }
-
Schedule a status change to
obsolete
.resource "ibm_is_image" "example" { name = "example-image" href = "cos://us-south/buckettesttest/livecd.ubuntu-cpc.azure.vhd" operating_system = "ubuntu-16-04-amd64" obsolescence_at = "2023-11-28T15:10:00.000Z" }
If you want to change the
deprecation_at
andobsolescence_at
date and time entries, you can run these commands again. The previous dates and times are replaced with the new dates and times.
Remove previously scheduled custom image lifecycle status using Terraform
To remove any scheduled status change, update the deprecation_at
or obsolescence_at
attributes to null
. This attribute change removes the date and time from the image and the image is no longer scheduled
for that status change.
-
To change an image from
deprecated
toavailable
, change thedeprecation_at
property tonull
.resource "ibm_is_image" "example" { name = "example-image" href = "cos://us-south/buckettesttest/livecd.ubuntu-cpc.azure.vhd" operating_system = "ubuntu-16-04-amd64" deprecation_at = null }
-
To change an image from
obsolete
to its previous state, changeobsolescence_at
tonull
. If the image previously contained a value other thannull
fordeprecation_at
, then this attribute change removes theobsolete
state and changes it back todeprecated
. If the previous state wasavailable
, meaning the image was moved fromavailable
directly toobsolete
, then this attribute change moves fromobsolete
back toavailable
.resource "ibm_is_image" "example" { name = "example-image" href = "cos://us-south/buckettesttest/livecd.ubuntu-cpc.azure.vhd" operating_system = "ubuntu-16-04-amd64" obsolescence_at = null }
-
To change an image that has both the
deprecation_at
orobsolescence_at
properties set back toavailable
, you must update both thedeprecation_at
orobsolescence_at
attributes.resource "ibm_is_image" "example" { name = "example-image" href = "cos://us-south/buckettesttest/livecd.ubuntu-cpc.azure.vhd" operating_system = "ubuntu-16-04-amd64" deprecation_at = null obsolescence_at = null }