Skip to content

Commit 1f49a44

Browse files
authored
Merge pull request #56 from JBAnderson5/EBSsubmodules
EBS submodules
2 parents f2c455a + e846070 commit 1f49a44

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+2999
-0
lines changed
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# Oracle Cloud Foundation Terraform Module - Identity - quickly create common identity resources with sensible defaults
2+
3+
4+
5+
## Table of Contents
6+
1. [Overview](#overview)
7+
1. [Deliverables](#deliverables)
8+
1. [Architecture](#Architecture-Diagram)
9+
1. [Executing Instructions](#instructions)
10+
1. [Documentation](#documentation)
11+
1. [The Team](#team)
12+
1. [Feedback](#feedback)
13+
1. [Known Issues](#known-issues)
14+
15+
16+
## <a name="overview"></a>Overview
17+
This module allows you to quickly create common identity resources like compartments, groups, dynamic groups, and policies. Most of these resources are predefined with sensible defaults. What you need to decide is which sets of resources you want and where you want to put them.
18+
19+
20+
## <a name="deliverables"></a>Deliverables
21+
This folder contains several deliverables:
22+
- a Terraform child module that creates the identity resources
23+
- several example parent modules that use the child module to create an identity structure
24+
- empty - this shows how the module creates nothing by default and only requires the tenancy ocid
25+
- basic - this shows how a company might create a basic identity structure for a single department and application
26+
- complex - this shows how a company might create a more complex identity structure for multiple deparments deploying multiple isolated applications
27+
28+
## <a name="architecture"></a>Architecture-Diagram
29+
This diagram below shows the basic architecture pattern and services this module creates. Note this pattern is very modular, so you can create these common compartments anywhere you need them in your compartment structure.
30+
![](./documentation/identity_module_pattern.png)
31+
32+
## <a name="instructions"></a>Executing Instructions
33+
34+
## Prerequisites
35+
The executor of this stack will need permissions and quotas to create several types of identity resources. It is recommended that an account in the administrator group initially runs this stack and then hands off management to the iam group, who can update it and create additional stacks using this child module.
36+
37+
## Deployment
38+
This module is a child module and can't be run directly. It needs a parent module to call this module to run. See the examples folder for example parent modules that call this submodule
39+
### source type
40+
github url with path and git tag is recommended for production code. local path is used for sub-module development and customization
41+
- github url - make sure to update the version tag to latest stable git tag version for initial deployment. If already deployed and you want to update the version, you need to validate that the new child module version works with your codebase and doesn't create dangerous resource changes, deletions, or creations
42+
```
43+
source = https://github.com/oracle-devrel/terraform-oci-oracle-cloud-foundation//cloud-foundation/modules/cloud-foundation-library/identity/module?ref=v1.2.0
44+
```
45+
- local path - this should be used if you are customizing the module. The actual path will need to be updated to where your child module resides relative to your parent module.
46+
```
47+
source = "../../module"
48+
```
49+
50+
## Resources Created
51+
52+
The "tenancy_ocid" variable is always required, but doesn't create any resources itself.
53+
54+
### Tenancy-Wide Resource Sets
55+
These Resources can only be deployed once in a tenancy.
56+
57+
#### IAM and Cred Admins
58+
the "create_identity_persona" variable will create two groups with a policy for each group to manage identity resources.
59+
- IAM group will have manage access to most identity resources excluding managing users, Administrator group,cred group, and linking external identity provider
60+
- Cred group will have access to create, update, and delete various Authentication methods for users including API keys and Auth tokens
61+
- Administrator group (comes default in tenancy) will still need to be used to create and delete users. You can also federate users from an external identity provider
62+
63+
#### Cost Admins
64+
The "create_cost_persona" variable will create one group with a policy to manage access to cost resources and usage-reports across the tenancy
65+
66+
#### Audtiors
67+
The "create_auditor_persona" variable will create one group with a policy to inspect all resources and read specific resource types across the tenancy including compute, networking, storage, iam, and security resources
68+
69+
#### Announcement Readers
70+
The "create_announcement_personaa" variable will create one group with a policy to read announcements across the tenancy
71+
72+
### Compartment-scoped Resource Sets
73+
These Resources can be deployed multiple times in your compartment structure, but will need unique prefixes/names across your tenancy. The "prefix" variable will be appended to the beginning of the name of all resources under the compartment scope. The "allow_compartment_deletion" variable is used across all created compartments. Default behavior is false, which means compartments will not be deleted when running a destroy job and will not be created if there already is an existing compartment with the same name.
74+
75+
#### Enclosing Compartment
76+
You can use the "existing_compartment" variable to determine a compartment to branch from. By default, this will use the root(tenancy) compartment. You can optionally create an enclosing compartment within that existing compartment using the "enclosing_compartment_name" variable. If left blank, other compartments will be created directly in the existing compartment.
77+
78+
#### Network
79+
The "create_network_persona" creates a compartment, two groups, and a policy for network resources. The "network_name" variable can be used to customize the name of these resources.
80+
- Network Admin group will have manage access to network resources and some common resources in this compartment
81+
- Network Service group will have use access to specific network resources needed to create instances within the vcns the Network Admin group defines.
82+
83+
#### Security
84+
The "create_security_persona" variable creates a compartment, two groups, and two policies for security resources. The "security_name" variable can be used to customize the name of these resources.
85+
- Security Admin group will have manage access to security resources and some common resources in this compartment. Additionally they will also have a tenancy level policy to manage certain tenancy-level security resources and monitor activity across the tenancy
86+
- Security Service group will use access access to specific security resources that the Security Admin groups defines.
87+
88+
##### certificates
89+
The "enable_ca" variable will create a dynamic group and policy that is required to use Certificate Authorities in the Certificate Service. This is scoped to the security compartment.
90+
91+
There are more services that have required dynamic groups and policies to use that we plan on including in future releases. Please let us know in an issue if there is one you want included in the next release
92+
93+
#### Database
94+
The "create_database_persona" variable creates a compartment, two groups, and a policy for database resources. The "database_name" variable can be used to customize the name of these resources.
95+
- Database Admin group will have manage access to database resources and some common resources in this compartment.
96+
- Database Service group will use access access to specific database resources that the Database Admin groups defines.
97+
98+
#### Application
99+
The "create_application_persona" variable creates a number of compartments, groups, and policies for application resources. The "application_name" variable can be used to customize the name of these resources. The "application_type" variable is used to determine what policies this application needs.
100+
101+
By default, a single, top level compartment is created.The "application_environments" variable allows you to determine how many isolated environments your application needs. For each name listed in "application_environments", a sub compartment will be created under the top level application compartment. Each compartment created will come with a group and a policy scoped to just that compartment. The Application Admin group will have manage access to application resources and some common resources in this compartment.
102+
103+
104+
#### Custom
105+
The "create_custom_persona" variable can be used to create a custom set of identity resources. The "custom_persona_name" variable should be used to name these resources according to their purpose. By default, a new compartment will be created. You can also set the "create_custom_compartment" variable to false to create your group and policy in the enclosing or existing compartment instead.
106+
107+
The "custom_policy_permissions" variable should be used to list the policy permissions (verb + resource) you want to give this group. Create a list of the verb + resource required for your policy statements. The rest of the statements will be generated for you. ex. ["read all-resources"]
108+
109+
110+
## <a name="documentation"></a>Documentation
111+
112+
[Identity Overview](https://docs.oracle.com/en-us/iaas/Content/Identity/Concepts/overview.htm)
113+
114+
## <a name="team"></a>The Team
115+
- **Owners**: [JB Anderson](https://github.com/JBAnderson5)
116+
117+
## <a name="feedback"></a>Feedback
118+
We welcome your feedback. To post feedback, submit feature ideas or report bugs, please use the Issues section on this repository.
119+
120+
## <a name="known-issues"></a>Known Issues
121+
**At the moment, there are no known issues**

cloud-foundation/modules/cloud-foundation-library/identity/documentation/identity_module_pattern.drawio

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.
215 KB
Loading
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
2+
3+
4+
# inputs
5+
6+
7+
# outputs
8+
9+
10+
# logic
11+
12+
13+
# resource or mixed module blocks
14+
15+
16+
module "identity" {
17+
# pick a source type - github url with path and git tag is recommended for production code. local path is used for sub-module development and customization
18+
# source = https://github.com/oracle-devrel/terraform-oci-oracle-cloud-foundation//cloud-foundation/modules/cloud-foundation-library/identity/module?ref=v1.2.0
19+
source = "../../module"
20+
21+
# tenancy level groups and policies
22+
create_announcement_persona = true
23+
create_auditor_persona = true
24+
create_cost_persona = true
25+
create_general_persona = true
26+
create_identity_persona = true
27+
28+
# compartment structure
29+
tenancy_ocid = var.tenancy_ocid
30+
enclosing_compartment_name = "department"
31+
prefix = "MyDepartment"
32+
33+
34+
# Standard IT compartments, groups, and policies
35+
create_application_persona = true
36+
application_name = "MyApp"
37+
application_environments = ["Prod", "Non-Prod"]
38+
create_database_persona = true
39+
create_network_persona = true
40+
create_security_persona = true
41+
42+
43+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
2+
#Auth Vars
3+
variable "tenancy_ocid" {}
4+
variable "region" {}
5+
variable "current_user_ocid" {}
6+
variable "fingerprint" {
7+
default = ""
8+
}
9+
variable "private_key_path" {
10+
default = ""
11+
}
12+
13+
14+
15+
provider "oci" {
16+
tenancy_ocid = "${var.tenancy_ocid}"
17+
user_ocid = "${var.current_user_ocid}"
18+
fingerprint = "${var.fingerprint}"
19+
private_key_path = "${var.private_key_path}"
20+
region = "${var.region}"
21+
22+
}
23+
24+
terraform {
25+
26+
required_version = ">= 1.0.0, < 2.0.0"
27+
28+
required_providers {
29+
oci = {
30+
source = "hashicorp/oci"
31+
version = ">= 4.79.0, < 5.0.0"
32+
}
33+
}
34+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
title: "Empty Identity Stack"
2+
description: "This example stack shows the minimum configuration needed for the identity module"
3+
schemaVersion: 1.1.0
4+
version: "20190404"
5+
6+
7+
locale: en
8+
9+
variableGroups:
10+
- title: "RM controlled Vars"
11+
visible: false
12+
variables:
13+
- tenancy_ocid
14+
- region
15+
- current_user_ocid
16+
- fingerprint
17+
- private_key_path
18+
19+
20+
variables:
21+
#"RM controlled Vars"
22+
tenancy_ocid:
23+
type: string
24+
title: Tenancy ID
25+
description: OCID of the tenancy
26+
required: true
27+
28+
region:
29+
type: oci:identity:region:name
30+
title: Region
31+
description: region to create resources
32+
required: true
33+
34+
current_user_ocid:
35+
type: string
36+
37+
fingerprint:
38+
type: string
39+
default: " "
40+
41+
private_key_path:
42+
type: string
43+
default: " "
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
3+
4+
/*
5+
6+
# The special test_assertions resource type, which belongs
7+
# to the test provider we required above, is a temporary
8+
# syntax for writing out explicit test assertions.
9+
resource "test_assertions" "bucket" {
10+
# "component" serves as a unique identifier for this
11+
# particular set of assertions in the test results.
12+
component = "bucket"
13+
equal "bucket_name" {
14+
description = "default bucket_name is natali-test-eu-627"
15+
got = module.main.bucket_name # value from the output
16+
want = "natali-test-eu-627"
17+
}
18+
}
19+
20+
21+
*/
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
2+
3+
4+
# inputs
5+
6+
7+
# outputs
8+
9+
10+
# logic
11+
12+
13+
# resource or mixed module blocks
14+
15+
16+
module "core-identity" {
17+
# pick a source type - github url with path and git tag is recommended for production code. local path is used for sub-module development and customization
18+
# source = https://github.com/oracle-devrel/terraform-oci-oracle-cloud-foundation//cloud-foundation/modules/cloud-foundation-library/identity/module?ref=v1.2.0
19+
source = "../../module"
20+
21+
# tenancy level groups and policies
22+
create_announcement_persona = true
23+
create_auditor_persona = true
24+
create_cost_persona = true
25+
create_general_persona = true
26+
create_identity_persona = true
27+
28+
# compartment structure
29+
tenancy_ocid = var.tenancy_ocid
30+
31+
# Standard IT compartments, groups, and policies
32+
create_database_persona = true
33+
create_network_persona = true
34+
create_security_persona = true
35+
36+
}
37+
38+
39+
module "dept1-identity" {
40+
# pick a source type - github url with path and git tag is recommended for production code. local path is used for sub-module development and customization
41+
# source = https://github.com/oracle-devrel/terraform-oci-oracle-cloud-foundation//cloud-foundation/modules/cloud-foundation-library/identity/module?ref=v1.2.0
42+
source = "../../module"
43+
44+
45+
# compartment structure
46+
tenancy_ocid = var.tenancy_ocid
47+
enclosing_compartment_name = "department"
48+
prefix = "Dept1"
49+
50+
51+
# Standard IT compartments, groups, and policies
52+
create_application_persona = true
53+
application_name = "MyApp"
54+
application_environments = ["Prod", "Non-Prod"]
55+
}
56+
module "dept1-app2" {
57+
# pick a source type - github url with path and git tag is recommended for production code. local path is used for sub-module development and customization
58+
# source = https://github.com/oracle-devrel/terraform-oci-oracle-cloud-foundation//cloud-foundation/modules/cloud-foundation-library/identity/module?ref=v1.2.0
59+
source = "../../module"
60+
61+
# compartment structure
62+
tenancy_ocid = var.tenancy_ocid
63+
existing_compartment = module.dept1-identity.enclosing_compartment
64+
65+
# Standard IT compartments, groups, and policies
66+
create_application_persona = true
67+
application_name = "MyApp2"
68+
application_environments = ["Prod", "Non-Prod", "dev", "test"]
69+
}
70+
71+
72+
73+
module "dept2-identity" {
74+
# pick a source type - github url with path and git tag is recommended for production code. local path is used for sub-module development and customization
75+
# source = https://github.com/oracle-devrel/terraform-oci-oracle-cloud-foundation//cloud-foundation/modules/cloud-foundation-library/identity/module?ref=v1.2.0
76+
source = "../../module"
77+
78+
79+
# compartment structure
80+
tenancy_ocid = var.tenancy_ocid
81+
enclosing_compartment_name = "department"
82+
prefix = "Dept2"
83+
84+
85+
# Standard IT compartments, groups, and policies
86+
create_application_persona = true
87+
application_name = "MyApp"
88+
application_environments = ["Prod", "Non-Prod"]
89+
create_database_persona = true
90+
database_name = "DB"
91+
92+
create_custom_persona = true
93+
custom_persona_name = "Sandbox"
94+
custom_policy_permissions = ["manage all-resources"]
95+
96+
}

0 commit comments

Comments
 (0)