-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmarketplace.tf
85 lines (66 loc) · 4.05 KB
/
marketplace.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# Copyright (c) 2020 Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
locals {
mkp_image_details = local.mkp_instances == null ? {} : {
for k, v in local.mkp_instances : k => {
mkp_image_name = v.mkp_image_name
mkp_image_version = v.mkp_image_name_version
mkp_image_ocid = data.oci_core_app_catalog_listing_resource_version.app_catalog_listing_resource_version[k].listing_resource_id
mkp_image_time_published = data.oci_core_app_catalog_listing_resource_version.app_catalog_listing_resource_version[k].time_published
mkp_image_agreement_id = oci_marketplace_accepted_agreement.accepted_agreements[k].id
mkp_image_agreement_name = oci_marketplace_accepted_agreement.accepted_agreements[k].display_name
mkp_image_agreement_accept_time = oci_marketplace_accepted_agreement.accepted_agreements[k].time_accepted
mkp_image_publisher = data.oci_marketplace_listing.listing[k].publisher[0].name
mkp_image_publisher_email = data.oci_marketplace_listing.listing[k].publisher[0].contact_email
mkp_image_publisher_phone = data.oci_marketplace_listing.listing[k].publisher[0].contact_phone
mkp_image_license_model_description = data.oci_marketplace_listing.listing[k].license_model_description
}
}
}
resource "oci_marketplace_accepted_agreement" "accepted_agreements" {
for_each = local.mkp_instances == null ? {} : local.mkp_instances
agreement_id = oci_marketplace_listing_package_agreement.listing_package_agreement[each.key].agreement_id
compartment_id = var.default_compartment_id
listing_id = data.oci_marketplace_listing.listing[each.key].id
package_version = data.oci_marketplace_listing.listing[each.key].default_package_version
signature = oci_marketplace_listing_package_agreement.listing_package_agreement[each.key].signature
}
resource "oci_marketplace_listing_package_agreement" "listing_package_agreement" {
for_each = local.mkp_instances == null ? {} : local.mkp_instances
agreement_id = data.oci_marketplace_listing_package_agreements.listing_package_agreements[each.key].agreements.0.id
listing_id = data.oci_marketplace_listing.listing[each.key].id
package_version = data.oci_marketplace_listing.listing[each.key].default_package_version
}
data "oci_marketplace_listing_package_agreements" "listing_package_agreements" {
for_each = local.mkp_instances == null ? {} : local.mkp_instances
listing_id = data.oci_marketplace_listing.listing[each.key].id
package_version = data.oci_marketplace_listing.listing[each.key].default_package_version
}
data "oci_marketplace_listing_package" "listing_package" {
for_each = local.mkp_instances == null ? {} : local.mkp_instances
listing_id = data.oci_marketplace_listing.listing[each.key].id
package_version = each.value.mkp_image_name_version
}
data "oci_marketplace_listing_packages" "listing_packages" {
for_each = local.mkp_instances == null ? {} : local.mkp_instances
listing_id = data.oci_marketplace_listing.listing[each.key].id
}
data "oci_marketplace_listing" "listing" {
for_each = local.mkp_instances == null ? {} : local.mkp_instances
listing_id = data.oci_marketplace_listings.listings[each.key].listings.0.id
}
data "oci_marketplace_listings" "listings" {
for_each = local.mkp_instances == null ? {} : local.mkp_instances
name = [each.value.mkp_image_name]
}
data "oci_core_app_catalog_listings" "app_catalog_listings" {
for_each = local.mkp_instances == null ? {} : local.mkp_instances
#Optional
display_name = each.value.mkp_image_name
}
data "oci_core_app_catalog_listing_resource_version" "app_catalog_listing_resource_version" {
for_each = local.mkp_instances == null ? {} : local.mkp_instances
#Required
listing_id = data.oci_core_app_catalog_listings.app_catalog_listings[each.key].app_catalog_listings[0].listing_id
resource_version = each.value.mkp_image_name_version
}