Skip to content

Commit e684bf1

Browse files
hyderDjelibeybi
authored andcommitted
added module for admin server. issue #21. also fixed issue #20
Signed-off-by: Ali Mukadam <[email protected]>
1 parent c2a0837 commit e684bf1

39 files changed

+934
-305
lines changed

docs/instanceprincipal.adoc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,16 @@ This section documents the use of {uri-oci-instance-principal}[instance_principa
3232

3333
=== Using instance_principal
3434

35-
==== Enabling instance_principal on the bastion host
35+
==== Enabling instance_principal on the admin host
3636
{uri-oci-instance-principal}[instance_principal] is an IAM service feature that enables instances to be authorized actors (or principals) to perform actions on service resources. Each compute instance has its own identity, and it authenticates using the certificates that are added to it. These certificates are automatically created, assigned to instances and rotated, preventing the need for you to distribute credentials to your hosts and rotate them.
3737

3838
Any user who has access to the instance (who can SSH to the instance), automatically inherits the privileges granted to the instance. Before you enable this feature, ensure that you know who can access it, and that they should be authorized with the permissions you are granting to the instance.
3939

40-
By default, this feature is *_disabled_*.
40+
By default, this feature is *_enabled_*.
4141

42-
When you enable this feature, by default, the bastion has privileges to all resources in the compartment.
42+
When you enable this feature, by default, the admin host has privileges to all resources in the compartment.
4343

44-
You can also turn on and off the feature at any time without impact on the bastion.
44+
You can also turn on and off the feature at any time without impact on the admin host.
4545

4646
To enable, set enable_instance_principal to true:
4747

@@ -55,7 +55,7 @@ and verify:
5555
oci network vcn list --compartment-id <compartment-ocid>
5656
----
5757

58-
==== Disabling instance_principal on the bastion host
58+
==== Disabling instance_principal on the admin host
5959

6060
. Set enable_instance_principal to false in terraform.tfvars
6161

@@ -74,5 +74,5 @@ terraform apply
7474
==== Recommendations for using instance_principal
7575

7676
. Do not enable instance_principal if you are not using it
77-
. Enable instance_principal *_if and only if_* you are using the bastion host to execute oci commands e.g. modifying dynamic groups, changing policies
77+
. Enable instance_principal *_if and only if_* you are using the admin host to execute oci commands e.g. modifying dynamic groups, changing policies
7878
. Disable instance_principal once the oci operation is done

docs/notifications.adoc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ The {uri-oci-notifications}[Oracle Cloud Infrastructure Notifications service] c
3232
Set the following parameters in the terraform.tfvars in order to enable ONS Notification for the bastion host:
3333

3434
----
35-
enable_instance_principal = true
36-
enable_notification = true
35+
notification_enabled = true
3736
notification_endpoint = "email_address"
3837
notification_protocol = "EMAIL"
3938
notification_topic = "bastion"
@@ -66,7 +65,7 @@ Read more on {uri-instance-principal}[instance_principal].
6665
Set the following parameters in the terraform.tfvars to disable ONS Notification:
6766

6867
----
69-
enable_notification = false
68+
notification_enabled = false
7069
----
7170

7271
and run terraform apply again:

docs/prerequisites.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ Open a terminal and test:
7777
[source,bash]
7878
----
7979
terraform -v
80-
Terraform v0.12.8
80+
Terraform v0.12.16
8181
----
8282

8383
=== OCI API Keys
@@ -113,7 +113,7 @@ To obtain the compartment OCID:
113113

114114
=== Identity and Access Management Rights
115115

116-
If you are enabling notifications and instance_principal for the bastion, the Terraform user must have the rights to manage dynamic groups.
116+
If you are enabling notifications for the bastion host or instance_principal for the admin server, the Terraform user must have the rights to manage policies and dynamic groups respectively.
117117

118118
=== Using Autonomous Linux
119119

docs/quickstart.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ cp terraform.tfvars.example terraform.tfvars
6060
* region
6161

6262
4. Optional parameters to override:
63-
* create_bastion
63+
* bastion_enabled
6464
* ssh_private_key_path
6565
* ssh_public_key_path
6666
* vcn_dns_label

docs/terraformoptions.adoc

Lines changed: 75 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Configuration Terraform Options:
2121
. link:#general-oci[General OCI]
2222
. link:#oci-networking[OCI Networking]
2323
. link:#bastion-host[Bastion Host]
24+
. link:#admin-host[Admin Host]
2425

2526
=== Identity and access
2627

@@ -88,12 +89,12 @@ Configuration Terraform Options:
8889
|Values
8990
|Default
9091

91-
|create_nat_gateway
92+
|nat_gateway_enabled
9293
|Whether to create a NAT gateway. *Required* for private subnets.
9394
|true/false
94-
|false
95+
|true
9596

96-
|create_service_gateway
97+
|service_gateway_enabled
9798
|Whether to create a Service Gateway to use Oracle Services.
9899
|true/false
99100
|false
@@ -141,6 +142,11 @@ Configuration Terraform Options:
141142
|XXX.XXX.XXX.XXX/YY
142143
|ANYWHERE
143144

145+
|bastion_enabled
146+
|Whether to create the bastion host.
147+
|true/false
148+
|true
149+
144150
|bastion_image_id
145151
|Custom image id for the bastion host
146152
|image id or NONE. If the value is set to NONE, an Oracle Platform image will be used instead. Set use_autonomous to _false_ if you want to use your own image.
@@ -156,16 +162,6 @@ Configuration Terraform Options:
156162
|true/false
157163
|true
158164

159-
|create_bastion
160-
|Whether to create the bastion host.
161-
|true/false
162-
|false
163-
164-
|enable_instance_principal
165-
|Whether to enable instance_principal on the bastion. Refer to {uri-instance-principal-note}[instance_principal].
166-
|true/false
167-
|false
168-
169165
|enable_notification
170166
|Whether to enable ONS notification for the bastion host.
171167
|true/false
@@ -231,4 +227,70 @@ Configuration Terraform Options:
231227
|true/false
232228
|false
233229

230+
|===
231+
232+
== Admin Host
233+
234+
[stripes=odd,cols="1d,4d,3a,3a", options=header,width="100%"]
235+
|===
236+
|Parameter
237+
|Description
238+
|Values
239+
|Default
240+
241+
|admin_enabled
242+
|Whether to create the admin host.
243+
|true/false
244+
|true
245+
246+
|admin_image_id
247+
|Custom image id for the admin host
248+
|image_id or NONE. If the value is set to NONE, an Oracle Platform image will be used instead. Set use_autonomous to _false_ if you want to use your own image. For now, *do not use Autonomous for the admin host.*
249+
|NONE
250+
251+
|enable_instance_principal
252+
|Whether to enable instance_principal on the admin server. Refer to {uri-instance-principal-note}[instance_principal][instance_principal]
253+
|true/false
254+
|true
255+
256+
|admin_notification_enabled
257+
|Whether to enable ONS notification for the admin host. *Do not enable for now*.
258+
|true/false
259+
|false
260+
261+
|admin_notification_endpoint
262+
|The subscription notification endpoint. Email address to be notified. Only email is currently supported although ONS can also support Slack, Pagerduty among others.
263+
|
264+
|
265+
266+
|admin_notification_protocol
267+
|The notification protocol used.
268+
|EMAIL
269+
|EMAIL
270+
271+
|admin_notification_topic
272+
|The name of the notification topic
273+
|
274+
|admin
275+
276+
|admin_package_upgrade
277+
|Whether to also upgrade the packages for the admin host.
278+
|true/false
279+
|true
280+
281+
|admin_shape
282+
|The shape of admin instance.
283+
|
284+
|VM.Standard.E2.1
285+
286+
|admin_timezone
287+
|The preferred timezone for the admin host. {uri-timezones}[List of timezones]
288+
|
289+
|Australia/Sydney
290+
291+
|admin_use_autonomous
292+
|Whether to use Autonomous Linux or an Oracle Linux Platform image or custom image. Set to false if you want to use your own image id or Oracle Linux Platform image. *Do not use autonomous for now*
293+
|true/false
294+
|false
295+
234296
|===

examples/db/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ module "base" {
7878
7979
# bastion parameters
8080
oci_base_bastion = local.oci_base_bastion
81+
82+
# admin server parameters
83+
oci_base_admin = local.oci_base_admin
8184
}
8285
```
8386

examples/db/locals.tf

Lines changed: 35 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,31 +20,49 @@ locals {
2020
}
2121

2222
oci_base_vcn = {
23-
create_nat_gateway = var.create_nat_gateway
24-
create_service_gateway = var.create_service_gateway
23+
create_nat_gateway = var.nat_gateway_enabled
24+
create_service_gateway = var.service_gateway_enabled
2525
vcn_cidr = var.vcn_cidr
2626
vcn_dns_label = var.vcn_dns_label
2727
vcn_name = var.vcn_name
2828
}
2929

3030
oci_base_bastion = {
31-
availability_domains = var.availability_domains["bastion"]
32-
bastion_access = var.bastion_access
33-
bastion_image_id = "NONE"
34-
bastion_shape = var.bastion_shape
35-
bastion_upgrade = false
36-
create_bastion = var.create_bastion
37-
enable_instance_principal = var.enable_instance_principal
38-
enable_notification = false
39-
newbits = var.newbits["bastion"]
40-
netnum = var.subnets["bastion"]
41-
notification_endpoint = ""
42-
notification_protocol = "EMAIL"
43-
notification_topic = "bastion"
31+
availability_domains = var.availability_domains["bastion"]
32+
bastion_access = var.bastion_access
33+
bastion_image_id = var.bastion_image_id
34+
bastion_shape = var.bastion_shape
35+
bastion_upgrade = var.bastion_package_upgrade
36+
bastion_enabled = var.bastion_enabled
37+
netnum = var.netnum["bastion"]
38+
newbits = var.newbits["bastion"]
39+
notification_enabled = var.bastion_notification_enabled
40+
notification_endpoint = var.bastion_notification_endpoint
41+
notification_protocol = var.bastion_notification_protocol
42+
notification_topic = var.bastion_notification_topic
43+
ssh_private_key_path = var.ssh_private_key_path
44+
ssh_public_key_path = var.ssh_public_key_path
45+
timezone = var.bastion_timezone
46+
use_autonomous = var.bastion_use_autonomous
47+
}
48+
49+
oci_base_admin = {
50+
availability_domains = var.availability_domains["admin"]
51+
admin_image_id = "NONE"
52+
admin_shape = var.admin_shape
53+
admin_upgrade = var.admin_package_upgrade
54+
admin_enabled = var.admin_enabled
55+
enable_instance_principal = var.admin_instance_principal
56+
netnum = var.netnum["admin"]
57+
newbits = var.newbits["admin"]
58+
notification_enabled = var.admin_notification_enabled
59+
notification_endpoint = var.admin_notification_endpoint
60+
notification_protocol = var.admin_notification_protocol
61+
notification_topic = var.admin_notification_topic
4462
ssh_private_key_path = var.ssh_private_key_path
4563
ssh_public_key_path = var.ssh_public_key_path
46-
timezone = "Australia/Sydney"
47-
use_autonomous = false
64+
timezone = var.admin_timezone
65+
use_autonomous = var.admin_use_autonomous
4866
}
4967

5068
db_identity = {

0 commit comments

Comments
 (0)