Skip to content

Commit fe20e40

Browse files
authored
Merge pull request #1 from parkerjohns/ocm-customer-prerequisites
OCM Customer Policy prerequisites
2 parents 4799bda + 87d0644 commit fe20e40

33 files changed

+366
-1593
lines changed

.gitignore

Lines changed: 0 additions & 38 deletions
This file was deleted.

README.md

Lines changed: 7 additions & 247 deletions
Original file line numberDiff line numberDiff line change
@@ -1,250 +1,10 @@
1-
# oci-quickstart-template
1+
# Overview
2+
This repository related to the [prerequisites](https://docs.oracle.com/en-us/iaas/Content/cloud-migration/cloud-migration-get-started.htm#cloud-migration-prerequisites-ocm) needed to use Oracle Cloud Migrations.
23

3-
The [Oracle Cloud Infrastructure (OCI) Quick Start](https://github.com/oracle-quickstart?q=oci-quickstart) is a collection of examples that allow Oracle Cloud Infrastructure users to get a quick start deploying advanced infrastructure on OCI.
4+
# Included Resources
45

5-
The oci-quickstart-template repository contains the template that can be used for accelerating the construction of quickstarts that runs from local Terraform CLI, [OCI Resource Manager](https://docs.cloud.oracle.com/en-us/iaas/Content/ResourceManager/Concepts/resourcemanager.htm) and [OCI Cloud Shell](https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/cloudshellintro.htm).
6+
- Compartments - The recommended Migration and MigrationSecrets [compartments](https://docs.oracle.com/en-us/iaas/Content/cloud-migration/cloud-migration-get-started.htm#cloud-migration-recommendations-compartments).
7+
- OCI Vault and Key - The vault used to store [vCenter credentials](https://docs.oracle.com/en-us/iaas/Content/cloud-migration/cloud-migration-remote-agent-appliance.htm#cloud-migration-vsphere-privileges).
8+
- Object Storage Bucket - The Object Storage [bucket](https://docs.oracle.com/en-us/iaas/Content/cloud-migration/cloud-migration-understand-vm-replication.htm#cloud-migration-replication-bucket) used for transferring vSphere snapshot data into OCI.
9+
- Mandatory Serivce Policies - The mandatory [service policies](https://docs.oracle.com/en-us/iaas/Content/cloud-migration/cloud-migration-servicepolicies.htm) and assoicated dynamic groups needed for OCM serivce components to function.
610

7-
Simple is a sample quickstart terraform template that deploys a virtual machine on a Virtual Cloud Network.
8-
Simple can be customized to subscribe and launch Marketplace images, Platform images or Custom images.
9-
10-
This repo is under active development. Building open source software is a community effort. We're excited to engage with the community building this.
11-
12-
## Resource Manager Deployment
13-
14-
This Quick Start uses [OCI Resource Manager](https://docs.cloud.oracle.com/iaas/Content/ResourceManager/Concepts/resourcemanager.htm) to make deployment easy, sign up for an [OCI account](https://cloud.oracle.com/en_US/tryit) if you don't have one, and just click the button below:
15-
16-
[![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-quickstart-template/archive/master.zip)
17-
18-
After logging into the console you'll be taken through the same steps described
19-
in the [Deploy](#deploy) section below.
20-
21-
22-
Note, if you use this template to create another repo you'll need to change the link for the button to point at your repo.
23-
24-
## Local Development
25-
26-
First off we'll need to do some pre deploy setup. That's all detailed [here](https://github.com/oracle/oci-quickstart-prerequisites).
27-
28-
Note, the instructions below build a `.zip` file from you local copy for use in ORM.
29-
If you want to not use ORM and deploy with the terraform CLI you need to rename
30-
`provider.tf.cli -> provider.tf`. This is because authentication works slightly
31-
differently in ORM vs the CLI. This file is ignored by the build process below.
32-
33-
Make sure you have terraform v0.14+ cli installed and accessible from your terminal.
34-
35-
### Build
36-
37-
Simply `build` your package and follow the [Resource Manager instructions](https://docs.cloud.oracle.com/en-us/iaas/Content/ResourceManager/Tasks/managingstacksandjobs.htm#console) for how to create a stack. Prior to building the Stack, you may want to modify some parts of the deployment detailed below.
38-
39-
In order to `build` the zip file with the latest changes you made to this code, you can simply go to [build-orm](./build-orm) folder and use terraform to generate a new zip file:
40-
41-
At first time, you are required to initialize the terraform modules used by the template with `terraform init` command:
42-
43-
```bash
44-
$ terraform init
45-
46-
Initializing the backend...
47-
48-
Initializing provider plugins...
49-
- Finding latest version of hashicorp/archive...
50-
- Installing hashicorp/archive v2.1.0...
51-
- Installed hashicorp/archive v2.1.0 (signed by HashiCorp)
52-
53-
Terraform has created a lock file .terraform.lock.hcl to record the provider
54-
selections it made above. Include this file in your version control repository
55-
so that Terraform can guarantee to make the same selections by default when
56-
you run "terraform init" in the future.
57-
58-
Terraform has been successfully initialized!
59-
60-
You may now begin working with Terraform. Try running "terraform plan" to see
61-
any changes that are required for your infrastructure. All Terraform commands
62-
should now work.
63-
64-
If you ever set or change modules or backend configuration for Terraform,
65-
rerun this command to reinitialize your working directory. If you forget, other
66-
commands will detect it and remind you to do so if necessary.
67-
```
68-
69-
Once terraform is initialized, just run `terraform apply` to generate ORM zip file.
70-
71-
```bash
72-
$ terraform apply
73-
74-
data.archive_file.generate_zip: Refreshing state...
75-
76-
Apply complete! Resources: 0 added, 0 changed, 0 destroyed.
77-
```
78-
79-
This command will package the content of `simple` folder into a zip and will store it in the `build-orm\dist` folder. You can check the content of the file by running `unzip -l dist/orm.zip`:
80-
81-
```bash
82-
$ unzip -l dist/orm.zip
83-
Archive: dist/orm.zip
84-
Length Date Time Name
85-
--------- ---------- ----- ----
86-
1140 01-01-2049 00:00 compute.tf
87-
680 01-01-2049 00:00 data_sources.tf
88-
1632 01-01-2049 00:00 image_subscription.tf
89-
1359 01-01-2049 00:00 locals.tf
90-
13548 01-01-2049 00:00 schema.yaml
91-
2001 01-01-2049 00:00 network.tf
92-
2478 01-01-2049 00:00 nsg.tf
93-
830 01-01-2049 00:00 oci_images.tf
94-
1092 01-01-2049 00:00 outputs.tf
95-
44 01-01-2049 00:00 scripts/example.sh
96-
4848 01-01-2049 00:00 variables.tf
97-
311 01-01-2049 00:00 versions.tf
98-
--------- -------
99-
29963 12 files
100-
```
101-
102-
### Deploy
103-
104-
1. [Login](https://console.us-ashburn-1.oraclecloud.com/resourcemanager/stacks/create) to Oracle Cloud Infrastructure to import the stack
105-
> `Home > Solutions & Platform > Resource Manager > Stacks > Create Stack`
106-
107-
2. Upload the `orm.zip` and provide a name and description for the stack
108-
![Create Stack](./images/create_orm_stack.png)
109-
110-
3. Configure the Stack. The UI will present the variables to the user dynamically, based on their selections. These are the configuration options:
111-
112-
> Compute Configuration
113-
114-
| VARIABLE | DESCRIPTION |
115-
|----------------------------|-----------------------------------------------------------------------|
116-
|COMPUTE COMPARTMENT | Compartment for Compute resources, including Marketplace subscription |
117-
|INSTANCE NAME | Compute instance name|
118-
|DNS HOSTNAME LABEL | DNS Hostname|
119-
|COMPUTE SHAPE | Compatible Compute shape|
120-
|FLEX SHAPE OCPUS | Number of OCPUs, only available for VM.Standard.E3.Flex compute shape|
121-
|AVAILABILITY DOMAIN | Availability Domain|
122-
|PUBLIC SSH KEY STRING | RSA PUBLIC SSH key string used for sign in to the OS|
123-
124-
> Virtual Cloud Network
125-
126-
| VARIABLE | DESCRIPTION |
127-
|----------------------------|-----------------------------------------------------------------------|
128-
|NETWORK COMPARTMENT | Compartment for all Virtual Cloud Network resources|
129-
|NETWORK STRATEGY | `Create New VCN and Subnet`: Create new network resources during apply. <br> `Use Existing VCN and Subnet`: Let user select pre-existent network resources.|
130-
|CONFIGURATION STRATEGY | `Use Recommended Configuration`: Use default configuration defined by the Terraform template. <br> `Customize Network Configuration`: Allow user to customize network configuration such as name, dns label, cidr block for VCN and Subnet.|
131-
132-
> Virtual Cloud Network - Customize Network Configuration
133-
134-
| VARIABLE | DESCRIPTION |
135-
|----------------------------|-----------------------------------------------------------------------|
136-
|NAME | VCN Display Name|
137-
|DNS LABEL | VCN DNS LABEL|
138-
|CIDR BLOCK | The CIDR of the new Virtual Cloud Network (VCN). If you plan to peer this VCN with another VCN, the VCNs must not have overlapping CIDRs.|
139-
140-
> Simple Subnet (visible only when `Customize Network Configuration` is selected)
141-
142-
| VARIABLE | DESCRIPTION |
143-
|----------------------------|-----------------------------------------------------------------------|
144-
|SUBNET TYPE | `Public Subnet` or `Private Subnet`|
145-
|NAME | Subnet Display Name|
146-
|DNS LABEL | Subnet DNS LABEL|
147-
|CIDR BLOCK | The CIDR of the Subnet. Should not overlap with any other subnet CIDRs|
148-
|NETWORK SECURITY GROUP CONFIGURATION| `Use Recommended Configuration`: Use default configuration defined by the Terraform template. <br> `Customize Network Security Group`: Allow user to customize some basic network security group settings.|
149-
150-
> Network Security Group (visible only when `Customize Network Security Group` is selected)
151-
152-
| VARIABLE | DESCRIPTION |
153-
|----------------------------|-----------------------------------------------------------------------|
154-
|NAME | NSG Display Name|
155-
|ALLOWED INGRESS TRAFFIC (CIDR BLOCK)| WHITELISTED CIDR BLOCK for ingress traffic|
156-
|SSH PORT NUMBER | Default SSH PORT for ingress traffic|
157-
|HTTP PORT NUMBER | Default HTTP PORT for ingress traffic|
158-
|HTTPS PORT NUMBER | Default HTTPS PORT for ingress traffic|
159-
160-
> Additional Configuration Options
161-
162-
| VARIABLE | DESCRIPTION |
163-
|----------------------------|-----------------------------------------------------------------------|
164-
|TAG KEY NAME | Free-form tag key name|
165-
|TAG VALUE | Free-form tag value|
166-
167-
4. Click Next and Review the configuration.
168-
5. Click Create button to confirm and create your ORM Stack.
169-
6. On Stack Details page, you can now run `Terraform` commands to manage your infrastructure. You typically start with a plan then run apply to create and make changes to the infrastructure. More details below:
170-
171-
| TERRAFORM ACTIONS | DESCRIPTION |
172-
|----------------------------|-----------------------------------------------------------------------|
173-
|Plan | `terraform plan` is used to create an execution plan. This command is a convenient way to check the execution plan prior to make any changes to the infrastructure resources.|
174-
|Apply | `terraform apply` is used to apply the changes required to reach the desired state of the configuration described by the template.|
175-
|Destroy | `terraform destroy` is used to destroy the Terraform-managed infrastructure.|
176-
177-
## Customize for Marketplace
178-
179-
In case you wanted to make changes to this template to use a Marketplace image rather than a platform image or custom image, you need to make the following changes.
180-
181-
1. Configure Marketplace listing variables on [`variables.tf`](./variables.tf).
182-
183-
| VARIABLES | DESCRIPTION |
184-
|----------------------------|-----------------------------------------------------------------------|
185-
|mp_subscription_enabled | Enable subscription to Marketplace.|
186-
|mp_listing_id | Marketplace App Catalog Listing OCID.|
187-
|mp_listing_resource_id | Marketplace Listing Image OCID.|
188-
|mp_listing_resource_version | Marketplace Listing Package/Resource Version (Reference value)|
189-
190-
2. Modify [`compute.tf`](./compute.tf) set `source_details` to refer to `local.compute_image_id` rather than `platform_image_id`. The `local.compute_image_id` holds the logic to either refer to the marketplace image or a custom image, based on the `mp_subscription_enabled` flag.
191-
192-
```hcl
193-
resource "oci_core_instance" "simple-vm" {
194-
availability_domain = local.availability_domain
195-
compartment_id = var.compute_compartment_ocid
196-
display_name = var.vm_display_name
197-
shape = var.vm_compute_shape
198-
199-
dynamic "shape_config" {
200-
for_each = local.is_flex_shape
201-
content {
202-
ocpus = shape_config.value
203-
}
204-
}
205-
206-
207-
create_vnic_details {
208-
subnet_id = local.use_existing_network ? var.subnet_id : oci_core_subnet.simple_subnet[0].id
209-
display_name = var.subnet_display_name
210-
assign_public_ip = local.is_public_subnet
211-
hostname_label = var.hostname_label
212-
skip_source_dest_check = false
213-
nsg_ids = [oci_core_network_security_group.simple_nsg.id]
214-
}
215-
216-
source_details {
217-
source_type = "image"
218-
#use a marketplace image or custom image:
219-
source_id = local.compute_image_id
220-
}
221-
222-
```
223-
2. Modify [`oci_images.tf`](./oci_images.tf) set `marketplace_source_images` map variable to refer to the marketplace images your Stack will launch.
224-
225-
```hcl
226-
227-
variable "marketplace_source_images" {
228-
type = map(object({
229-
ocid = string
230-
is_pricing_associated = bool
231-
compatible_shapes = list(string)
232-
}))
233-
default = {
234-
main_mktpl_image = {
235-
ocid = "ocid1.image.oc1..<unique_id>"
236-
is_pricing_associated = true
237-
compatible_shapes = []
238-
}
239-
#Remove comment and add as many marketplace images that your stack references be replicated to other realms
240-
#supporting_image = {
241-
# ocid = "ocid1.image.oc1..<unique_id>"
242-
# is_pricing_associated = false
243-
# compatible_shapes = ["VM.Standard2.2", "VM.Standard.E2.1.Micro"]
244-
#}
245-
}
246-
}
247-
248-
```
249-
250-
2. Run your tests using the Terraform CLI or build a new package and deploy on ORM.

build-orm/install.tf

Lines changed: 0 additions & 10 deletions
This file was deleted.

compute.tf

Lines changed: 0 additions & 43 deletions
This file was deleted.

data_sources.tf

Lines changed: 0 additions & 19 deletions
This file was deleted.

datasources.tf

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
data "oci_identity_tenancy" "tenancy" {
2+
tenancy_id = var.tenancy_ocid
3+
}
4+
5+
data "oci_identity_regions" "regions" {
6+
}
7+
8+
data "oci_objectstorage_namespace" "objectstorage_namespace" {
9+
}
10+
11+
data "oci_identity_region_subscriptions" "region_subscriptions" {
12+
tenancy_id = var.tenancy_ocid
13+
filter {
14+
name = "region_name"
15+
values = [var.region]
16+
}
17+
}

0 commit comments

Comments
 (0)