Skip to content

Commit ad8104f

Browse files
authored
Merge pull request #3 from oracle-devrel/flex-bastion
Injectable BastionVM/BastionService
2 parents 3f31bd3 + 2fe4cff commit ad8104f

File tree

30 files changed

+1579
-27
lines changed

30 files changed

+1579
-27
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ This Module has the following folder structure:
2121
* [examples](examples): This folder contains examples of how to use the module:
2222
- [Joomla single-node + custom network injected into module](examples/joomla-single-mds-use-existing-network): This is an example of how to use the oci-arch-joomla module to deploy Joomla (single-node) with MDS and network cloud infrastrucutre elements injected into the module.
2323
- [Joomla multi-node + custom network injected into module](examples/joomla-ha-mds-use-existing-network): This is an example of how to use the oci-arch-joomla module to deploy Joomla HA (multi-node) with MDS and network cloud infrastrucutre elements injected into the module.
24-
24+
- [Joomla multi-node + custom network + Bastion Host injected into module](examples/joomla-ha-mds-use-existing-network-and-injected-bastion-host): This is an example of how to use the oci-arch-jooma module to deploy Joomla HA (multi-node) with MDS and network cloud infrastrucutre elements + Bastion Host injected into the module.
25+
- [Joomla multi-node + custom network + Bastion Service injected into module](examples/joomla-ha-mds-use-existing-network-and-injected-bastion-service): This is an example of how to use the oci-arch-joomla module to deploy Joomla HA (multi-node) with MDS and network cloud infrastrucutre elements + Bastion Service injected into the module.
26+
2527
To deploy Joomla using this Module with minimal effort use this:
2628

2729
```hcl
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
Copyright (c) 2022 Oracle and/or its affiliates.
2+
3+
The Universal Permissive License (UPL), Version 1.0
4+
5+
Subject to the condition set forth below, permission is hereby granted to any
6+
person obtaining a copy of this software, associated documentation and/or data
7+
(collectively the "Software"), free of charge and under any and all copyright
8+
rights in the Software, and any and all patent rights owned or freely
9+
licensable by each licensor hereunder covering either (i) the unmodified
10+
Software as contributed to or provided by such licensor, or (ii) the Larger
11+
Works (as defined below), to deal in both
12+
13+
(a) the Software, and
14+
(b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
15+
one is included with the Software (each a "Larger Work" to which the Software
16+
is contributed by such licensors),
17+
18+
without restriction, including without limitation the rights to copy, create
19+
derivative works of, display, perform, and distribute the Software and make,
20+
use, sell, offer for sale, import, export, have made, and have sold the
21+
Software and the Larger Work(s), and to sublicense the foregoing rights on
22+
either these or other terms.
23+
24+
This license is subject to the following condition:
25+
The above copyright notice and either this complete permission notice or at
26+
a minimum a reference to the UPL must be included in all copies or
27+
substantial portions of the Software.
28+
29+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
35+
SOFTWARE.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
## Create Joomla multi-node + custom network & Bastion Host injected into module
2+
This is an example of how to use the oci-arch-joomla module to deploy Joomla HA (multi-node) with MDS and network cloud infrastructure elements + Bastion Host injected into the module.
3+
4+
### Using this example
5+
Update terraform.tfvars with the required information.
6+
7+
### Deploy the Joomla
8+
Initialize Terraform:
9+
```
10+
$ terraform init
11+
```
12+
View what Terraform plans do before actually doing it:
13+
```
14+
$ terraform plan
15+
```
16+
Use Terraform to Provision resources:
17+
```
18+
$ terraform apply
19+
```
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
## Copyright (c) 2022 Oracle and/or its affiliates.
2+
## All rights reserved. The Universal Permissive License (UPL), Version 1.0 as shown at http://oss.oracle.com/licenses/upl
3+
4+
resource "oci_core_instance" "bastion" {
5+
availability_domain = local.availability_domain_name
6+
compartment_id = var.compartment_ocid
7+
display_name = "bastionvm"
8+
shape = var.bastion_shape
9+
10+
dynamic "shape_config" {
11+
for_each = local.is_flexible_node_shape ? [1] : []
12+
content {
13+
memory_in_gbs = var.bastion_flex_shape_memory
14+
ocpus = var.bastion_flex_shape_ocpus
15+
}
16+
}
17+
18+
create_vnic_details {
19+
subnet_id = oci_core_subnet.bastion_subnet_public.id
20+
assign_public_ip = true
21+
}
22+
23+
source_details {
24+
source_type = "image"
25+
source_id = data.oci_core_images.InstanceImageOCID2.images[0].id
26+
}
27+
28+
metadata = {
29+
ssh_authorized_keys = module.oci-arch-joomla.generated_ssh_public_key
30+
}
31+
32+
}
33+
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
## Copyright (c) 2022 Oracle and/or its affiliates.
2+
## All rights reserved. The Universal Permissive License (UPL), Version 1.0 as shown at http://oss.oracle.com/licenses/upl
3+
4+
data "oci_core_images" "InstanceImageOCID" {
5+
compartment_id = var.compartment_ocid
6+
operating_system = var.instance_os
7+
operating_system_version = var.linux_os_version
8+
shape = var.node_shape
9+
10+
filter {
11+
name = "display_name"
12+
values = ["^.*Oracle[^G]*$"]
13+
regex = true
14+
}
15+
}
16+
17+
data "oci_core_images" "InstanceImageOCID2" {
18+
compartment_id = var.compartment_ocid
19+
operating_system = var.instance_os
20+
operating_system_version = var.linux_os_version
21+
shape = var.bastion_shape
22+
23+
filter {
24+
name = "display_name"
25+
values = ["^.*Oracle[^G]*$"]
26+
regex = true
27+
}
28+
}
29+
30+
data "oci_mysql_mysql_configurations" "shape" {
31+
compartment_id = var.compartment_ocid
32+
type = ["DEFAULT"]
33+
shape_name = var.mysql_shape
34+
}
35+
36+
data "oci_identity_region_subscriptions" "home_region_subscriptions" {
37+
tenancy_id = var.tenancy_ocid
38+
39+
filter {
40+
name = "is_home_region"
41+
values = [true]
42+
}
43+
}
44+
45+
data "oci_identity_availability_domains" "ADs" {
46+
compartment_id = var.tenancy_ocid
47+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
## Copyright (c) 2022, Oracle and/or its affiliates.
2+
## All rights reserved. The Universal Permissive License (UPL), Version 1.0 as shown at http://oss.oracle.com/licenses/upl
3+
4+
module "oci-arch-joomla" {
5+
source = "github.com/oracle-devrel/terraform-oci-arch-joomla"
6+
tenancy_ocid = var.tenancy_ocid
7+
vcn_id = oci_core_virtual_network.joomla_mds_vcn.id
8+
numberOfNodes = 2
9+
availability_domain_name = var.availability_domain_name == "" ? lookup(data.oci_identity_availability_domains.ADs.availability_domains[0], "name") : var.availability_domain_name
10+
compartment_ocid = var.compartment_ocid
11+
image_id = lookup(data.oci_core_images.InstanceImageOCID.images[0], "id")
12+
shape = var.node_shape
13+
ssh_authorized_keys = var.ssh_public_key
14+
mds_ip = module.mds-instance.mysql_db_system.ip_address
15+
joomla_subnet_id = oci_core_subnet.joomla_subnet.id
16+
lb_subnet_id = oci_core_subnet.lb_subnet_public.id
17+
bastion_subnet_id = oci_core_subnet.bastion_subnet_public.id
18+
fss_subnet_id = oci_core_subnet.fss_subnet_private.id
19+
admin_password = var.admin_password
20+
admin_username = var.admin_username
21+
joomla_schema = var.joomla_schema
22+
joomla_name = var.joomla_name
23+
joomla_password = var.joomla_password
24+
display_name = var.joomla_name
25+
joomla_console_user = var.joomla_console_user
26+
joomla_console_password = var.joomla_console_password
27+
joomla_console_email = var.joomla_console_email
28+
lb_shape = var.lb_shape
29+
flex_lb_min_shape = var.flex_lb_min_shape
30+
flex_lb_max_shape = var.flex_lb_max_shape
31+
use_bastion_service = false
32+
inject_bastion_service_id = false
33+
inject_bastion_server_public_ip = true
34+
bastion_server_public_ip = oci_core_instance.bastion.public_ip
35+
bastion_service_region = var.region
36+
}
37+
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
## Copyright (c) 2022, Oracle and/or its affiliates.
2+
## All rights reserved. The Universal Permissive License (UPL), Version 1.0 as shown at http://oss.oracle.com/licenses/upl
3+
4+
module "mds-instance" {
5+
source = "github.com/oracle-devrel/terraform-oci-cloudbricks-mysql-database?ref=v1.0.4.1"
6+
tenancy_ocid = var.tenancy_ocid
7+
region = var.region
8+
mysql_instance_compartment_ocid = var.compartment_ocid
9+
mysql_network_compartment_ocid = var.compartment_ocid
10+
subnet_id = oci_core_subnet.mds_subnet_private.id
11+
mysql_db_system_admin_username = var.admin_username
12+
mysql_db_system_admin_password = var.admin_password
13+
mysql_db_system_availability_domain = var.availability_domain_name == "" ? lookup(data.oci_identity_availability_domains.ADs.availability_domains[0], "name") : var.availability_domain_name
14+
mysql_shape_name = var.mysql_shape
15+
mysql_db_system_data_storage_size_in_gb = var.mysql_db_system_data_storage_size_in_gb
16+
mysql_db_system_description = var.mysql_db_system_description
17+
mysql_db_system_display_name = var.mysql_db_system_display_name
18+
mysql_db_system_fault_domain = var.mysql_db_system_fault_domain
19+
mysql_db_system_hostname_label = var.mysql_db_system_hostname_label
20+
mysql_db_system_is_highly_available = var.mysql_is_highly_available
21+
mysql_db_system_maintenance_window_start_time = var.mysql_db_system_maintenance_window_start_time
22+
}

0 commit comments

Comments
 (0)