This repository has been archived by the owner on May 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
image_subscription.tf
54 lines (46 loc) · 2.43 KB
/
image_subscription.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
#Local variables pointing to the Marketplace catalog resource
#Eg. Modify accordingly to your Application/Listing
locals {
mp_listing_id = var.mp_listing_id
mp_listing_resource_id = var.mp_listing_resource_id
mp_listing_resource_version = var.mp_listing_resource_version
}
#Get Image Agreement
resource "oci_core_app_catalog_listing_resource_version_agreement" "mp_image_agreement" {
count = var.use_marketplace_image ? 1 : 0
listing_id = local.mp_listing_id
listing_resource_version = local.mp_listing_resource_version
}
#Accept Terms and Subscribe to the image, placing the image in a particular compartment
resource "oci_core_app_catalog_subscription" "mp_image_subscription" {
count = var.use_marketplace_image ? 1 : 0
compartment_id = var.compartment_ocid
eula_link = oci_core_app_catalog_listing_resource_version_agreement.mp_image_agreement[0].eula_link
listing_id = oci_core_app_catalog_listing_resource_version_agreement.mp_image_agreement[0].listing_id
listing_resource_version = oci_core_app_catalog_listing_resource_version_agreement.mp_image_agreement[0].listing_resource_version
oracle_terms_of_use_link = oci_core_app_catalog_listing_resource_version_agreement.mp_image_agreement[0].oracle_terms_of_use_link
signature = oci_core_app_catalog_listing_resource_version_agreement.mp_image_agreement[0].signature
time_retrieved = oci_core_app_catalog_listing_resource_version_agreement.mp_image_agreement[0].time_retrieved
timeouts {
create = "20m"
}
}
# Gets the partner image subscription
data "oci_core_app_catalog_subscriptions" "mp_image_subscription" {
#Required
compartment_id = var.compartment_ocid
#Optional
listing_id = local.mp_listing_id
filter {
name = "listing_resource_version"
# TF-UPGRADE-TODO: In Terraform v0.10 and earlier, it was sometimes necessary to
# force an interpolation expression to be interpreted as a list by wrapping it
# in an extra set of list brackets. That form was supported for compatibility in
# v0.11, but is no longer supported in Terraform v0.12.
#
# If the expression in the following list itself returns a list, remove the
# brackets to avoid interpretation as a list of lists. If the expression
# returns a single list item then leave it as-is and remove this TODO comment.
values = [local.mp_listing_resource_version]
}
}