Skip to content

Commit 9496cf5

Browse files
authored
Merge pull request #2 from oracle-devrel/flex-bastion
Injectable BastionVM/BastionService
2 parents 5345b04 + 981161e commit 9496cf5

File tree

30 files changed

+1569
-16
lines changed

30 files changed

+1569
-16
lines changed

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ This Module has the following folder structure:
2323
* [examples](examples): This folder contains examples of how to use the module:
2424
- [Drupal single-node + custom network injected into module](examples/drupal-single-mds-use-existing-network): This is an example of how to use the oci-arch-drupal module to deploy Drupal (single-node) with MDS and network cloud infrastrucutre elements injected into the module.
2525
- [Drupal multi-node + custom network injected into module](examples/drupal-ha-mds-use-existing-network): This is an example of how to use the oci-arch-drupal module to deploy Drupal HA (multi-node) with MDS and network cloud infrastrucutre elements injected into the module.
26-
26+
- [Drupal multi-node + custom network + Bastion Host injected into module](examples/drupal-ha-mds-use-existing-network-and-injected-bastion-host): This is an example of how to use the oci-arch-drupal module to deploy Drupal HA (multi-node) with MDS and network cloud infrastrucutre elements + Bastion Host injected into the module.
27+
- [Drupal multi-node + custom network + Bastion Service injected into module](examples/drupal-ha-mds-use-existing-network-and-injected-bastion-service): This is an example of how to use the oci-arch-wordpress module to deploy Drupal HA (multi-node) with MDS and network cloud infrastrucutre elements + Bastion Service injected into the module.
2728
To deploy Drupal using this Module with minimal effort use this:
2829

2930
```hcl
@@ -70,6 +71,10 @@ flex_shape_memory | If shape is set to Flex shape then you can define Flex Shape
7071
lb_shape | If numberOfNodes set to 2 or more then you can define Load Balancer shape
7172
flex_lb_min_shape | If numberOfNodes set to 2 or more and lb_shape=flexible then you can define Load Balancer minimum shape.
7273
flex_lb_max_shape | If numberOfNodes set to 2 or more and lb_shape=flexible then you can define Load Balancer maximum shape.
74+
inject_bastion_service_id | Instead of counting on module to create Bastion Service you can pass Bastion Service OCID as input (set value to TRUE).
75+
bastion_service_id | If inject_bastion_service_id is set to TRUE then you can pass here Bastion Service OCID as input.
76+
inject_bastion_server_public_ip | Instead of counting on module to create Bastion VM you can pass Bastion Host Public IP Address as input (set value to TRUE).
77+
bastion_server_public_ip | If inject_bastion_server_public_ip is set to TRUE then you can pass here Bastion Host Public IP Address.
7378
use_bastion_service | If you want to use OCI Bastion Service then you need to set the value to TRUE.
7479
bastion_service_region | If use_bastion_service is set to TRUE then you can define bastion service region.
7580
bastion_image_id | If use_bastion_service is set to FALSE then you can define Bastion VM image id.
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 Drupal multi-node + custom network & Bastion Host injected into module
2+
This is an example of how to use the oci-arch-drupal module to deploy Drupal 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 Drupal
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-drupal.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: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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-drupal" {
5+
source = "github.com/oracle-devrel/terraform-oci-arch-drupal"
6+
tenancy_ocid = var.tenancy_ocid
7+
vcn_id = oci_core_virtual_network.drupal_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+
drupal_subnet_id = oci_core_subnet.drupal_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+
drupal_schema = var.drupal_schema
22+
drupal_name = var.drupal_name
23+
drupal_password = var.drupal_password
24+
display_name = var.drupal_name
25+
lb_shape = var.lb_shape
26+
flex_lb_min_shape = var.flex_lb_min_shape
27+
flex_lb_max_shape = var.flex_lb_max_shape
28+
use_bastion_service = false
29+
inject_bastion_service_id = false
30+
inject_bastion_server_public_ip = true
31+
bastion_server_public_ip = oci_core_instance.bastion.public_ip
32+
bastion_service_region = var.region
33+
}
34+
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)