From edf23e156276cb333673c1364107622a52edec2a Mon Sep 17 00:00:00 2001 From: Lukasz Feldman Date: Tue, 16 Feb 2021 09:50:57 +0100 Subject: [PATCH] First release --- README.md | 3 +-- cassandra.tf | 1 + network.tf | 6 +++++- schema.yaml | 7 +++++++ tags.tf | 25 +++++++++++++++++++++++++ variables.tf | 5 +++++ 6 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 tags.tf diff --git a/README.md b/README.md index c4b36bc..becb398 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,7 @@ If you don't have the required permissions and quota, contact your tenancy admin ## Deploy Using Oracle Resource Manager -1. Click [![Deploy to Oracle Cloud](https://oci-resourcemanager-plugin.plugins.oci.oraclecloud.com/latest/deploy-to-oracle-cloud.svg)](https://cloud.oracle.com/resourcemanager/stacks/create?region=home&zipUrl=https://github.com/oracle-quickstart/oci-arch-cassandra/raw/master/resource-manager/oci-arch-cassandra.zip) - +1. Click [![Deploy to Oracle Cloud](https://oci-resourcemanager-plugin.plugins.oci.oraclecloud.com/latest/deploy-to-oracle-cloud.svg)](https://cloud.oracle.com/resourcemanager/stacks/create?region=home&zipUrl=https://github.com/oracle-quickstart/oci-arch-cassandra/releases/latest/download/oci-arch-cassandra-stack-latest.zip) If you aren't already signed in, when prompted, enter the tenancy and user credentials. diff --git a/cassandra.tf b/cassandra.tf index 75fb8f9..477cf8e 100644 --- a/cassandra.tf +++ b/cassandra.tf @@ -16,4 +16,5 @@ module "cassandra" { ssh_authorized_keys = tls_private_key.public_private_key_pair.public_key_openssh ssh_private_key = tls_private_key.public_private_key_pair.private_key_pem cassandra_version = var.cassandra_version + defined_tags = {"${oci_identity_tag_namespace.ArchitectureCenterTagNamespace.name}.${oci_identity_tag.ArchitectureCenterTag.name}" = var.release } } diff --git a/network.tf b/network.tf index 08832a2..30b48a0 100644 --- a/network.tf +++ b/network.tf @@ -6,6 +6,7 @@ resource "oci_core_virtual_network" "CassandraVCN" { compartment_id = var.compartment_ocid display_name = "CassandraVCN" dns_label = "ocicassandra" + defined_tags = {"${oci_identity_tag_namespace.ArchitectureCenterTagNamespace.name}.${oci_identity_tag.ArchitectureCenterTag.name}" = var.release } } ############################################ @@ -15,6 +16,7 @@ resource "oci_core_internet_gateway" "CassandraIG" { compartment_id = var.compartment_ocid display_name = "${var.label_prefix}CassandraIG" vcn_id = oci_core_virtual_network.CassandraVCN.id + defined_tags = {"${oci_identity_tag_namespace.ArchitectureCenterTagNamespace.name}.${oci_identity_tag.ArchitectureCenterTag.name}" = var.release } } ############################################ @@ -31,6 +33,7 @@ resource "oci_core_route_table" "CassandraRT" { # Internet Gateway route target for instances on public subnets network_entity_id = oci_core_internet_gateway.CassandraIG.id } + defined_tags = {"${oci_identity_tag_namespace.ArchitectureCenterTagNamespace.name}.${oci_identity_tag.ArchitectureCenterTag.name}" = var.release } } ############################################ @@ -72,7 +75,7 @@ resource "oci_core_security_list" "CassandraSL" { protocol = "6" source = "0.0.0.0/0" } - + defined_tags = {"${oci_identity_tag_namespace.ArchitectureCenterTagNamespace.name}.${oci_identity_tag.ArchitectureCenterTag.name}" = var.release } } ############################################ @@ -92,4 +95,5 @@ resource "oci_core_subnet" "CassandraSubnet" { vcn_id = oci_core_virtual_network.CassandraVCN.id route_table_id = oci_core_route_table.CassandraRT.id dhcp_options_id = oci_core_virtual_network.CassandraVCN.default_dhcp_options_id + defined_tags = {"${oci_identity_tag_namespace.ArchitectureCenterTagNamespace.name}.${oci_identity_tag.ArchitectureCenterTag.name}" = var.release } } diff --git a/schema.yaml b/schema.yaml index 241f7a4..8034d42 100755 --- a/schema.yaml +++ b/schema.yaml @@ -30,6 +30,7 @@ variableGroups: - label_prefix - storage_port - ssl_storage_port + - release variables: @@ -149,6 +150,12 @@ variables: title: "SSL Storage Port in Cassandra cluster" description: "Choose SSL Storage Port in Cassandra cluster." + release: + type: string + required: false + visible: false + title: "Reference Architecture Release (OCI Architecture Center)" + outputs: generated_ssh_private_key: diff --git a/tags.tf b/tags.tf new file mode 100644 index 0000000..5cee19b --- /dev/null +++ b/tags.tf @@ -0,0 +1,25 @@ +resource "oci_identity_tag_namespace" "ArchitectureCenterTagNamespace" { + compartment_id = var.compartment_ocid + description = "ArchitectureCenterTagNamespace" + name = "ArchitectureCenter\\ha-cassandra-cluster" + + provisioner "local-exec" { + command = "sleep 10" + } +} + +resource "oci_identity_tag" "ArchitectureCenterTag" { + description = "ArchitectureCenterTag" + name = "release" + tag_namespace_id = oci_identity_tag_namespace.ArchitectureCenterTagNamespace.id + + validator { + validator_type = "ENUM" + values = ["release", "1.0"] + } + + provisioner "local-exec" { + command = "sleep 20" + } + +} diff --git a/variables.tf b/variables.tf index 2e36698..0235277 100644 --- a/variables.tf +++ b/variables.tf @@ -5,6 +5,11 @@ variable "private_key_path" {} variable "region" {} variable "compartment_ocid" {} +variable "release" { + description = "Reference Architecture Release (OCI Architecture Center)" + default = "1.0" +} + variable "instance_os" { description = "Operating system for compute instances" default = "Oracle Linux"