|
| 1 | +// Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. |
| 2 | +// Licensed under the Mozilla Public License v2.0 |
| 3 | +provider "oci" { |
| 4 | + tenancy_ocid = "${var.tenancy_ocid}" |
| 5 | + user_ocid = "${var.user_ocid}" |
| 6 | + fingerprint = "${var.fingerprint}" |
| 7 | + private_key_path = "${var.private_key_path}" |
| 8 | + region = "${var.region}" |
| 9 | +} |
| 10 | + |
| 11 | +variable "tenancy_ocid" {} |
| 12 | +variable "user_ocid" {} |
| 13 | +variable "fingerprint" {} |
| 14 | +variable "private_key_path" {} |
| 15 | +variable "region" {} |
| 16 | +variable "compartment_ocid" {} |
| 17 | + |
| 18 | +//https://github.com/terraform-providers/terraform-provider-oci/tree/master/examples/compute/image |
| 19 | +variable "custom_image_id" {} |
| 20 | + |
| 21 | +//example reference to schemaData values |
| 22 | +variable "schema_data_value" { |
| 23 | + default = "{\"descriptorType\": \"enumstring\",\"source\": \"IMAGE\",\"defaultValue\": \"PARAVIRTUALIZED\", \"values\": [\"PARAVIRTUALIZED\"]}" |
| 24 | +} |
| 25 | + |
| 26 | +//example reference to schemaData key |
| 27 | +variable "schema_data_key" { |
| 28 | + default = "Network.AttachmentType" |
| 29 | +} |
| 30 | + |
| 31 | +data "oci_core_compute_image_capability_schema" "test_compute_image_capability_schema" { |
| 32 | + compute_image_capability_schema_id = "${oci_core_compute_image_capability_schema.test_compute_image_capability_schema.id}" |
| 33 | + is_merge_enabled = "true" |
| 34 | +} |
| 35 | + |
| 36 | +resource "oci_core_compute_image_capability_schema" "test_compute_image_capability_schema" { |
| 37 | + compartment_id = "${var.compartment_ocid}" |
| 38 | + compute_global_image_capability_schema_version_name = "${data.oci_core_compute_global_image_capability_schemas_versions.test_compute_global_image_capability_schemas_versions_datasource.compute_global_image_capability_schema_versions.0.name}" |
| 39 | + display_name = "displayName" |
| 40 | + image_id = "${var.custom_image_id}" |
| 41 | + |
| 42 | + schema_data = "${ |
| 43 | + map( |
| 44 | + "${var.schema_data_key}","${var.schema_data_value}" |
| 45 | + ) |
| 46 | + }" |
| 47 | +} |
| 48 | + |
| 49 | +data "oci_core_compute_global_image_capability_schemas_version" test_compute_global_image_capability_schemas_version_datasource { |
| 50 | + compute_global_image_capability_schema_id = "${data.oci_core_compute_global_image_capability_schema.test_compute_global_image_capability_schema_datasource.id}" |
| 51 | + compute_global_image_capability_schema_version_name = "${data.oci_core_compute_global_image_capability_schemas_versions.test_compute_global_image_capability_schemas_versions_datasource.compute_global_image_capability_schema_versions.0.name}" |
| 52 | +} |
| 53 | + |
| 54 | +data "oci_core_compute_global_image_capability_schemas_versions" test_compute_global_image_capability_schemas_versions_datasource { |
| 55 | + compute_global_image_capability_schema_id = "${data.oci_core_compute_global_image_capability_schema.test_compute_global_image_capability_schema_datasource.id}" |
| 56 | +} |
| 57 | + |
| 58 | +data "oci_core_compute_global_image_capability_schema" test_compute_global_image_capability_schema_datasource { |
| 59 | + compute_global_image_capability_schema_id = "${data.oci_core_compute_global_image_capability_schemas.test_compute_global_image_capability_schemas_datasource.compute_global_image_capability_schemas.0.id}" |
| 60 | +} |
| 61 | + |
| 62 | +data "oci_core_compute_global_image_capability_schemas" test_compute_global_image_capability_schemas_datasource {} |
0 commit comments