Skip to content

Commit a6d143b

Browse files
add(oci): support home region (#7)
* add(oci): support home region * add(oci): support home region * add(oci): support home region
1 parent a986372 commit a6d143b

File tree

8 files changed

+46
-19
lines changed

8 files changed

+46
-19
lines changed

modules/config-posture/README.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ The following resources will be created in each instrumented compartment/tenancy
1313

1414
## Requirements
1515

16-
| Name | Version |
17-
|---------------------------------------------------------------------------|---------|
18-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0.0 |
16+
| Name | Version |
17+
|---------------------------------------------------------------------------|-----------|
18+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0.0 |
1919
| <a name="requirement_oci"></a> [oci](#requirement\_oci) | >= 6.19.0 |
20-
| <a name="requirement_sysdig"></a> [sysdig](#requirement\_sysdig) | ~> 1.42 |
20+
| <a name="requirement_sysdig"></a> [sysdig](#requirement\_sysdig) | ~> 1.42 |
2121

2222
## Providers
2323

@@ -42,12 +42,12 @@ resource |
4242

4343
## Inputs
4444

45-
| Name | Description | Type | Default | Required |
46-
|------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------|----------|------------------|:--------:|
47-
| <a name="input_is_organizational"></a> [is\_organizational](#input\_is\_organizational) | (Optional) True/False whether secure-for-cloud should be deployed in an organizational setup | `bool` | `false` | no |
48-
| <a name="input_tenancy_ocid"></a> [tenancy\_ocid](#input\_tenancy\_ocid) | (Required) Customer tenant OCID | `string` | n/a | yes |
49-
| <a name="input_compartment_ocid"></a> [compartment\_ocid](#input\_compartment\_ocid) | (Optional) Customer compartment OCID | `string` | `""` | no |
50-
| <a name="input_sysdig_secure_account_id"></a> [sysdig\_secure\_account\_id](#input\_sysdig\_secure\_account\_id) | (Required) ID of the Sysdig Cloud Account to enable Config Posture for (in case of organization, ID of the Sysdig management account) | `string` | n/a | yes |
45+
| Name | Description | Type | Default | Required |
46+
|------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------|----------|---------|:--------:|
47+
| <a name="input_is_organizational"></a> [is\_organizational](#input\_is\_organizational) | (Optional) True/False whether secure-for-cloud should be deployed in an organizational setup | `bool` | `false` | no |
48+
| <a name="input_tenancy_ocid"></a> [tenancy\_ocid](#input\_tenancy\_ocid) | (Required) Customer tenant OCID | `string` | n/a | yes |
49+
| <a name="input_compartment_ocid"></a> [compartment\_ocid](#input\_compartment\_ocid) | (Optional) Customer compartment OCID | `string` | `""` | no |
50+
| <a name="input_sysdig_secure_account_id"></a> [sysdig\_secure\_account\_id](#input\_sysdig\_secure\_account\_id) | (Required) ID of the Sysdig Cloud Account to enable Config Posture for (in case of organization, ID of the Sysdig management account) | `string` | n/a | yes |
5151

5252
## Outputs
5353

modules/config-posture/main.tf

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ resource "sysdig_secure_cloud_auth_account_component" "oracle_service_principal"
4545
oci = {
4646
api_key = {
4747
user_id = data.sysdig_secure_trusted_oracle_app.config_posture.user_ocid
48+
region = var.region
4849
}
4950
policy = {
5051
policy_id = oci_identity_policy.admit_cspm_policy.id

modules/config-posture/variables.tf

+5
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,9 @@ variable "compartment_ocid" {
1818
variable "sysdig_secure_account_id" {
1919
type = string
2020
description = "(Required) ID of the Sysdig Cloud Account to enable Config Posture for (in case of organization, ID of the Sysdig management account)"
21+
}
22+
23+
variable "region" {
24+
type = string
25+
description = "(Required) Customer home region"
2126
}

modules/onboarding/README.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ Note:
2020

2121
## Requirements
2222

23-
| Name | Version |
24-
|---------------------------------------------------------------------------|---------|
25-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0.0 |
23+
| Name | Version |
24+
|---------------------------------------------------------------------------|-----------|
25+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0.0 |
2626
| <a name="requirement_oci"></a> [oci](#requirement\_oci) | >= 6.19.0 |
27-
| <a name="requirement_sysdig"></a> [sysdig](#requirement\_sysdig) | ~> 1.42 |
27+
| <a name="requirement_sysdig"></a> [sysdig](#requirement\_sysdig) | ~> 1.42 |
2828

2929
## Providers
3030

@@ -51,11 +51,11 @@ resource |
5151

5252
## Inputs
5353

54-
| Name | Description | Type | Default | Required |
55-
|-----------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------|----------|------------------|:--------:|
56-
| <a name="input_is_organizational"></a> [is\_organizational](#input\_is\_organizational) | (Optional) True/False whether secure-for-cloud should be deployed in an organizational setup | `bool` | `false` | no |
57-
| <a name="input_tenancy_ocid"></a> [tenancy\_ocid](#input\_tenancy\_ocid) | (Required) Customer tenant OCID | `string` | n/a | yes |
58-
| <a name="input_compartment_ocid"></a> [compartment\_ocid](#input\_compartment\_ocid) | (Optional) Customer compartment OCID | `string` | `""` | no |
54+
| Name | Description | Type | Default | Required |
55+
|-----------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------|----------|---------|:--------:|
56+
| <a name="input_is_organizational"></a> [is\_organizational](#input\_is\_organizational) | (Optional) True/False whether secure-for-cloud should be deployed in an organizational setup | `bool` | `false` | no |
57+
| <a name="input_tenancy_ocid"></a> [tenancy\_ocid](#input\_tenancy\_ocid) | (Required) Customer tenant OCID | `string` | n/a | yes |
58+
| <a name="input_compartment_ocid"></a> [compartment\_ocid](#input\_compartment\_ocid) | (Optional) Customer compartment OCID | `string` | `""` | no |
5959

6060
## Outputs
6161

modules/onboarding/main.tf

+14
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
locals {
2+
home_region = [
3+
for subscription in data.oci_identity_region_subscriptions.test_region_subscriptions.region_subscriptions :
4+
subscription.region_name
5+
if subscription.is_home_region == true
6+
]
7+
}
8+
19
#-----------------------------------------------------------------------------------------
210
# Fetch the data sources
311
#-----------------------------------------------------------------------------------------
@@ -18,6 +26,11 @@ data "oci_identity_tenancy" "tenancy" {
1826
tenancy_id = var.tenancy_ocid
1927
}
2028

29+
// tenancy region data
30+
data "oci_identity_region_subscriptions" "test_region_subscriptions" {
31+
tenancy_id = var.tenancy_ocid
32+
}
33+
2134

2235
// random suffix for policy name
2336
resource "random_id" "suffix" {
@@ -61,6 +74,7 @@ resource "sysdig_secure_cloud_auth_account" "oracle_account" {
6174
oci = {
6275
api_key = {
6376
user_id = data.sysdig_secure_trusted_oracle_app.onboarding.user_ocid
77+
region = local.home_region[0]
6478
}
6579
policy = {
6680
policy_id = oci_identity_policy.admit_onboarding_policy.id

modules/onboarding/outputs.tf

+5
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,8 @@ output "is_organizational" {
1717
value = var.is_organizational
1818
description = "Boolean value to indicate if secure-for-cloud is deployed to an entire Oracle organization or not"
1919
}
20+
21+
output "region" {
22+
value = local.home_region[0]
23+
description = "Customer home region"
24+
}

tests/examples/modular_organization/onboarding_cspm_compartment.tf

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ module "config-posture" {
3636
tenancy_ocid = module.onboarding.tenancy_ocid
3737
compartment_ocid = module.onboarding.compartment_ocid
3838
is_organizational = module.onboarding.is_organizational
39+
region = module.onboarding.region
3940
}
4041

4142
resource "sysdig_secure_cloud_auth_account_feature" "config_posture" {

tests/examples/modular_organization/onboarding_cspm_tenancy.tf

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ module "config-posture" {
3535
tenancy_ocid = module.onboarding.tenancy_ocid
3636
compartment_ocid = module.onboarding.compartment_ocid
3737
is_organizational = module.onboarding.is_organizational
38+
region = module.onboarding.region
3839
}
3940

4041
resource "sysdig_secure_cloud_auth_account_feature" "config_posture" {

0 commit comments

Comments
 (0)