|
| 1 | +// Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. |
| 2 | +// Licensed under the Mozilla Public License v2.0 |
| 3 | + |
| 4 | +variable "tenancy_ocid" {} |
| 5 | +variable "user_ocid" {} |
| 6 | +variable "fingerprint" {} |
| 7 | +variable "private_key_path" {} |
| 8 | +variable "region" {} |
| 9 | +variable "compartment_id" {} |
| 10 | + |
| 11 | +variable "ccc_infrastructure_access_level" { |
| 12 | + default = "RESTRICTED" |
| 13 | +} |
| 14 | + |
| 15 | +variable "ccc_infrastructure_compartment_id_in_subtree" { |
| 16 | + default = false |
| 17 | +} |
| 18 | + |
| 19 | +variable "ccc_infrastructure_connection_details" { |
| 20 | + default = "connectionDetails" |
| 21 | +} |
| 22 | + |
| 23 | +variable "ccc_infrastructure_connection_state" { |
| 24 | + default = "REJECT" |
| 25 | +} |
| 26 | + |
| 27 | +variable "ccc_infrastructure_defined_tags_value" { |
| 28 | + default = "value" |
| 29 | +} |
| 30 | + |
| 31 | +variable "ccc_infrastructure_description" { |
| 32 | + default = "Datacenter 231" |
| 33 | +} |
| 34 | + |
| 35 | +variable "ccc_infrastructure_display_name" { |
| 36 | + default = "example_cccInfrastructure" |
| 37 | +} |
| 38 | + |
| 39 | +variable "ccc_infrastructure_display_name_contains" { |
| 40 | + default = "displayNameContains" |
| 41 | +} |
| 42 | + |
| 43 | +variable "ccc_infrastructure_freeform_tags" { |
| 44 | + default = { "bar-key" = "value" } |
| 45 | +} |
| 46 | + |
| 47 | +variable "ccc_infrastructure_state" { |
| 48 | + default = "ACTIVE" |
| 49 | +} |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | +provider "oci" { |
| 54 | + tenancy_ocid = var.tenancy_ocid |
| 55 | + user_ocid = var.user_ocid |
| 56 | + fingerprint = var.fingerprint |
| 57 | + private_key_path = var.private_key_path |
| 58 | + region = var.region |
| 59 | +} |
| 60 | + |
| 61 | +resource "oci_compute_cloud_at_customer_ccc_upgrade_schedule" "test_ccc_upgrade_schedule" { |
| 62 | +compartment_id = var.compartment_id |
| 63 | +display_name = "example_cccUpgradeSchedule" |
| 64 | +events { |
| 65 | +description = "description" |
| 66 | +schedule_event_duration = "PT49H" |
| 67 | +schedule_event_recurrences = "FREQ=MONTHLY;INTERVAL=3;" |
| 68 | +time_start = "2023-09-09T16:10:25Z" |
| 69 | +} |
| 70 | +} |
| 71 | + |
| 72 | +resource "oci_core_vcn" "test_vcn" { |
| 73 | +cidr_block = "10.0.0.0/16" |
| 74 | +compartment_id = var.compartment_id |
| 75 | +lifecycle { |
| 76 | +ignore_changes = ["defined_tags"] |
| 77 | +} |
| 78 | +} |
| 79 | + |
| 80 | +resource "oci_core_subnet" "test_subnet" { |
| 81 | +cidr_block = "10.0.0.0/24" |
| 82 | +compartment_id = var.compartment_id |
| 83 | +lifecycle { |
| 84 | +ignore_changes = ["defined_tags"] |
| 85 | +} |
| 86 | +vcn_id = oci_core_vcn.test_vcn.id |
| 87 | +} |
| 88 | + |
| 89 | +variable defined_tag_namespace_name { default = "" } |
| 90 | +resource "oci_identity_tag_namespace" "tag-namespace1" { |
| 91 | + #Required |
| 92 | + compartment_id = var.compartment_id |
| 93 | + description = "example tag namespace" |
| 94 | + name = "${var.defined_tag_namespace_name != "" ? var.defined_tag_namespace_name : "example-tag-namespace-all"}" |
| 95 | + |
| 96 | + is_retired = false |
| 97 | + lifecycle { |
| 98 | + ignore_changes = [] |
| 99 | + } |
| 100 | +} |
| 101 | + |
| 102 | +resource "oci_identity_tag" "tag1" { |
| 103 | + #Required |
| 104 | + description = "example tag" |
| 105 | + name = "example-tag" |
| 106 | + tag_namespace_id = oci_identity_tag_namespace.tag-namespace1.id |
| 107 | + |
| 108 | + is_retired = false |
| 109 | +} |
| 110 | + |
| 111 | +resource "oci_compute_cloud_at_customer_ccc_infrastructure" "test_ccc_infrastructure" { |
| 112 | + #Required |
| 113 | + compartment_id = var.compartment_id |
| 114 | + display_name = var.ccc_infrastructure_display_name |
| 115 | + subnet_id = oci_core_subnet.test_subnet.id |
| 116 | + |
| 117 | + #Optional |
| 118 | + ccc_upgrade_schedule_id = oci_compute_cloud_at_customer_ccc_upgrade_schedule.test_ccc_upgrade_schedule.id |
| 119 | + connection_details = var.ccc_infrastructure_connection_details |
| 120 | + connection_state = var.ccc_infrastructure_connection_state |
| 121 | + defined_tags = map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", var.ccc_infrastructure_defined_tags_value) |
| 122 | + description = var.ccc_infrastructure_description |
| 123 | + freeform_tags = var.ccc_infrastructure_freeform_tags |
| 124 | +} |
| 125 | + |
| 126 | +data "oci_compute_cloud_at_customer_ccc_infrastructures" "test_ccc_infrastructures" { |
| 127 | + |
| 128 | + #Optional |
| 129 | + access_level = var.ccc_infrastructure_access_level |
| 130 | + ccc_infrastructure_id = oci_compute_cloud_at_customer_ccc_infrastructure.test_ccc_infrastructure.id |
| 131 | + compartment_id = var.compartment_id |
| 132 | + compartment_id_in_subtree = var.ccc_infrastructure_compartment_id_in_subtree |
| 133 | + display_name = var.ccc_infrastructure_display_name |
| 134 | + display_name_contains = var.ccc_infrastructure_display_name_contains |
| 135 | + state = var.ccc_infrastructure_state |
| 136 | +} |
| 137 | + |
0 commit comments