generated from oracle-quickstart/oci-quickstart-template
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add exainfra only example and module with test automation
- Loading branch information
Showing
8 changed files
with
276 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# terrascan configuration file | ||
|
||
# https://runterrascan.io/docs/policies/ | ||
[rules] | ||
skip-rules = [ | ||
"accurics.azure.NS.272" | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
name: build | ||
|
||
on: | ||
push: | ||
branches: | ||
# - main | ||
- steven/* | ||
# pull_request: | ||
# branches: | ||
# - main | ||
|
||
permissions: {} | ||
|
||
jobs: | ||
docs: | ||
name: Generate terraform docs | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
packages: read | ||
statuses: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.pull_request.head.ref }} | ||
- name: Render terraform docs and push changes back to PR | ||
uses: terraform-docs/gh-actions@main | ||
with: | ||
working-dir: . | ||
output-file: README.md | ||
output-method: inject | ||
git-push: true | ||
recursive: true | ||
recursive-path: modules | ||
args: --recursive-include-main=false | ||
lint: | ||
name: Lint Code Base | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: read | ||
statuses: write | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Super-linter | ||
uses: github/super-linter@v6 | ||
env: | ||
# To report GitHub Actions status checks | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
VALIDATE_TERRAFORM_FMT: true | ||
VALIDATE_TERRAFORM_TFLINT: true | ||
VALIDATE_TERRAFORM_TERRASCAN: true | ||
VALIDATE_CHECKOV: true | ||
|
||
tofu_test_ubuntu: | ||
name: Tofu Test (ubuntu) | ||
environment: sandbox3 | ||
runs-on: ubuntu-latest | ||
needs: lint | ||
permissions: | ||
contents: read | ||
packages: read | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Azure login | ||
uses: azure/login@v2 | ||
with: | ||
creds: '{"clientId":"${{ secrets.ARM_CLIENT_ID }}","clientSecret":"${{ secrets.ARM_CLIENT_SECRET }}","subscriptionId":"${{ secrets.ARM_SUBSCRIPTIONS_ID }}","tenantId":"${{ secrets.ARM_TENANT_ID }}"}' | ||
- name: setup opentofu | ||
uses: opentofu/setup-opentofu@v1 | ||
with: | ||
tofu_version: 1.8.1 | ||
# - name: Iterate over each module for tofu test | ||
# run: | | ||
# for dir in $(find ./modules -maxdepth 1 -mindepth 1 -type d); do | ||
# echo "----- Testing $dir -----" | ||
# cd $dir | ||
# tofu init | ||
# tofu validate | ||
# tofu fmt -check | ||
# # tofu test | ||
# cd - # Go back to root directory | ||
# done | ||
- name: Iterate over each examples for tofu plan | ||
run: | | ||
# for dir in $(find ./examples -maxdepth 1 -mindepth 1 -type d); do | ||
# echo "----- Testing $dir -----" | ||
# cd $dir | ||
cd ./examples/exainfra_only | ||
tofu init | ||
tofu validate | ||
tofu fmt -check | ||
tofu plan | ||
cd - # Go back to root directory | ||
done | ||
# tofu_test_windows: | ||
# name: Tofu Test (windows) | ||
# environment: sandbox3 | ||
# runs-on: windows-latest | ||
# needs: lint | ||
# permissions: | ||
# contents: read | ||
# packages: read | ||
# steps: | ||
# - name: Checkout code | ||
# uses: actions/checkout@v4 | ||
# with: | ||
# fetch-depth: 0 | ||
# - name: Azure login | ||
# uses: azure/login@v2 | ||
# with: | ||
# creds: '{"clientId":"${{ secrets.ARM_CLIENT_ID }}","clientSecret":"${{ secrets.ARM_CLIENT_SECRET }}","subscriptionId":"${{ secrets.ARM_SUBSCRIPTIONS_ID }}","tenantId":"${{ secrets.ARM_TENANT_ID }}"}' | ||
# - name: setup opentofu | ||
# uses: opentofu/setup-opentofu@v1 | ||
# with: | ||
# tofu_version: 1.8.1 | ||
# - name: Iterate over each module and test | ||
# shell: powershell | ||
# run: | | ||
# $modules = Get-ChildItem -Path .\modules -Directory | ||
# foreach ($module in $modules) { | ||
# Write-Host "Testing module in $($module.FullName)" | ||
# Set-Location -Path $module.FullName | ||
# tofu init | ||
# tofu validate | ||
# tofu fmt -check | ||
# tofu test | ||
# Set-Location -Path $Env:GITHUB_WORKSPACE | ||
# } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module "azure-exainfra" { | ||
source = "../../modules/azure-exainfra" | ||
resource_group = "tftest-01" | ||
location = "eastus" | ||
zones = "3" | ||
exadata_infrastructure_resource_name = "tftest-01" | ||
exadata_infrastructure_shape = "Exadata.X9M" | ||
exadata_infrastructure_compute_cpu_count = 2 | ||
exadata_infrastructure_storage_count = 3 | ||
exadata_infrastructure_maintenance_window_lead_time_in_weeks = 0 | ||
exadata_infrastructure_maintenance_window_preference = "NoPreference" | ||
exadata_infrastructure_maintenance_window_patching_mode = "Rolling" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
resource "azurerm_resource_group" "az_rg" { | ||
name = var.resource_group | ||
location = var.location | ||
} | ||
|
||
|
||
resource "azapi_resource" "cloudExadataInfrastructure" { | ||
type = "Oracle.Database/cloudExadataInfrastructures@2023-09-01" | ||
parent_id = azurerm_resource_group.az_rg.id | ||
name = var.exadata_infrastructure_resource_name | ||
timeouts { | ||
create = "1h30m" | ||
delete = "20m" | ||
} | ||
body = { | ||
"location" : var.location, | ||
"zones" : [ | ||
var.zones | ||
], | ||
"properties" : { | ||
"computeCount" : var.exadata_infrastructure_compute_cpu_count, | ||
"displayName" : var.exadata_infrastructure_resource_name, | ||
"maintenanceWindow" : { | ||
"leadTimeInWeeks" : var.exadata_infrastructure_maintenance_window_lead_time_in_weeks, | ||
"preference" : var.exadata_infrastructure_maintenance_window_preference, | ||
"patchingMode" : var.exadata_infrastructure_maintenance_window_patching_mode | ||
}, | ||
"shape" : var.exadata_infrastructure_shape, | ||
"storageCount" : var.exadata_infrastructure_storage_count | ||
} | ||
} | ||
schema_validation_enabled = false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
output "exainfra_ocid" { | ||
value = azapi_resource.cloudExadataInfrastructure.id | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
terraform { | ||
required_providers { | ||
# https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs | ||
azurerm = { | ||
source = "hashicorp/azurerm" | ||
version = "~>3.99.0" | ||
} | ||
# https://registry.terraform.io/providers/Azure/azapi/latest/docs | ||
azapi = { | ||
source = "Azure/azapi" | ||
} | ||
} | ||
} | ||
|
||
provider "azurerm" { | ||
features { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
resource_group = "tftest-01" | ||
location="useast" | ||
zones="2" | ||
exadata_infrastructure_resource_name="tftest01" | ||
exadata_infrastructure_compute_cpu_count=2 | ||
exadata_infrastructure_resource_display_name="tftest-01" | ||
exadata_infrastructure_maintenance_window_lead_time_in_weeks=0 | ||
exadata_infrastructure_maintenance_window_preference="NoPreference" | ||
exadata_infrastructure_maintenance_window_patching_mode="Rolling" | ||
exadata_infrastructure_shape="Exadata.X9M" | ||
exadata_infrastructure_storage_count=3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
variable "location" { | ||
description = "The location of the exadata infrastructure." | ||
type = string | ||
} | ||
|
||
variable "zones" { | ||
description = "The zone of the exadata infrastructure." | ||
type = string | ||
} | ||
|
||
variable "resource_group" { | ||
type = string | ||
description = "Resource Group Name" | ||
} | ||
|
||
variable "exadata_infrastructure_resource_name" { | ||
description = "The name of the exadata infrastructure on Azure." | ||
type = string | ||
} | ||
# variable "exadata_infrastructure_resource_display_name" { | ||
# description = "The display name of the exadata infrastructure." | ||
# type = string | ||
# } | ||
|
||
variable "exadata_infrastructure_compute_cpu_count" { | ||
description = "The number of compute servers for the cloud Exadata infrastructure." | ||
type = number | ||
} | ||
|
||
variable "exadata_infrastructure_storage_count" { | ||
description = "The number of storage servers for the Exadata infrastructure." | ||
type = number | ||
} | ||
|
||
variable "exadata_infrastructure_shape" { | ||
description = "The shape of the cloud Exadata infrastructure resource. e.g. Exadata.X9M" | ||
type = string | ||
} | ||
|
||
variable "exadata_infrastructure_maintenance_window_lead_time_in_weeks" { | ||
description = "Lead time window allows user to set a lead time to prepare for a down time. The lead time is in weeks and valid value is between 1 to 4." | ||
type = number | ||
} | ||
|
||
variable "exadata_infrastructure_maintenance_window_preference" { | ||
description = "The maintenance window scheduling preference.Allowed values are: NO_PREFERENCE, CUSTOM_PREFERENCE." | ||
type = string | ||
} | ||
|
||
variable "exadata_infrastructure_maintenance_window_patching_mode" { | ||
description = "Cloud Exadata infrastructure node patching method, either ROLLING or NONROLLING." | ||
type = string | ||
} |