generated from terraform-ibm-modules/terraform-ibm-module-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added support to attach COS bucket to instance<br>* new input v…
…ariables: `cos_instance_crn`, `cos_bucket` and `skip_cos_iam_authorization_policy`<br>- added support to configure event notifications using new variable `en_instance_crn` (#21)
- Loading branch information
1 parent
7c4f11b
commit d1e5852
Showing
16 changed files
with
303 additions
and
14 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
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 |
---|---|---|
@@ -1,3 +1,16 @@ | ||
{ | ||
"scc_rules": [] | ||
"scc_rules": [ | ||
{ | ||
"scc_rule_id": "rule-8cbd597c-7471-42bd-9c88-36b2696456e9", | ||
"description": "Check whether Cloud Object Storage network access is restricted to a specific IP range", | ||
"ignore_reason": "This rule is not relevant to the module itself, just the COS resource that is used in the example that is scanned", | ||
"is_valid": false | ||
}, | ||
{ | ||
"scc_rule_id": "rule-c97259ee-336d-4c5f-b436-1868107a9558", | ||
"description": "Check whether Cloud Object Storage is enabled with customer-managed encryption and Keep Your Own Key (KYOK)", | ||
"ignore_reason": "This rule is not relevant to the module itself, just the COS resource that is used in the example that is scanned", | ||
"is_valid": 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
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
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
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 |
---|---|---|
|
@@ -6,7 +6,7 @@ terraform { | |
required_providers { | ||
ibm = { | ||
source = "IBM-Cloud/ibm" | ||
version = "1.61.0" | ||
version = "1.62.0" | ||
} | ||
} | ||
} |
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,6 @@ | ||
# Complete example | ||
|
||
A complete example that will provision the following: | ||
- A new resource group if one is not passed in. | ||
- A new event notification service instance | ||
- A new Security and Compliance Center instance with COS bucket and event notification configuration |
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,39 @@ | ||
module "resource_group" { | ||
source = "terraform-ibm-modules/resource-group/ibm" | ||
version = "1.1.4" | ||
resource_group_name = var.resource_group == null ? "${var.prefix}-resource-group" : null | ||
existing_resource_group_name = var.resource_group | ||
} | ||
|
||
module "cos" { | ||
source = "terraform-ibm-modules/cos/ibm" | ||
version = "7.2.2" | ||
cos_instance_name = "${var.prefix}-cos" | ||
kms_encryption_enabled = false | ||
retention_enabled = false | ||
resource_group_id = module.resource_group.resource_group_id | ||
bucket_name = "${var.prefix}-cb" | ||
} | ||
|
||
module "event_notification" { | ||
source = "terraform-ibm-modules/event-notifications/ibm" | ||
version = "1.0.4" | ||
resource_group_id = module.resource_group.resource_group_id | ||
name = "${var.prefix}-en" | ||
tags = var.resource_tags | ||
plan = "lite" | ||
service_endpoints = "public-and-private" | ||
region = var.region | ||
} | ||
|
||
module "create_scc_instance" { | ||
source = "../.." | ||
instance_name = "${var.prefix}-instance" | ||
region = var.region | ||
resource_group_id = module.resource_group.resource_group_id | ||
resource_tags = var.resource_tags | ||
cos_bucket = module.cos.bucket_name | ||
cos_instance_crn = module.cos.cos_instance_id | ||
en_instance_crn = module.event_notification.crn | ||
skip_cos_iam_authorization_policy = 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,53 @@ | ||
######################################################################################################################## | ||
# Outputs | ||
######################################################################################################################## | ||
|
||
output "resource_group_id" { | ||
description = "The id of the resource group where SCC instance is created by this module" | ||
value = module.resource_group.resource_group_id | ||
} | ||
|
||
output "id" { | ||
description = "The id of the SCC instance created by this module" | ||
value = module.create_scc_instance.id | ||
} | ||
|
||
output "guid" { | ||
description = "The GUID of the SCC instance created by this module" | ||
value = module.create_scc_instance.guid | ||
} | ||
|
||
output "crn" { | ||
description = "The CRN of the SCC instance created by this module" | ||
value = module.create_scc_instance.crn | ||
} | ||
|
||
output "name" { | ||
description = "The name of the SCC instance created by this module" | ||
value = module.create_scc_instance.name | ||
} | ||
|
||
output "location" { | ||
description = "The location of the SCC instance created by this module" | ||
value = module.create_scc_instance.location | ||
} | ||
|
||
output "plan" { | ||
description = "The pricing plan used to create SCC instance in this module" | ||
value = module.create_scc_instance.plan | ||
} | ||
|
||
output "en_crn" { | ||
description = "The CRN of the event notification instance created in this module" | ||
value = module.event_notification.crn | ||
} | ||
|
||
output "cos_instance_id" { | ||
description = "The COS instance ID created in this example" | ||
value = module.cos.cos_instance_id | ||
} | ||
|
||
output "cos_bucket" { | ||
description = "The COS bucket created in this example" | ||
value = module.cos.bucket_name | ||
} |
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,8 @@ | ||
######################################################################################################################## | ||
# Provider config | ||
######################################################################################################################## | ||
|
||
provider "ibm" { | ||
ibmcloud_api_key = var.ibmcloud_api_key | ||
region = var.region | ||
} |
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 @@ | ||
######################################################################################################################## | ||
# Input variables | ||
######################################################################################################################## | ||
|
||
variable "ibmcloud_api_key" { | ||
type = string | ||
description = "The IBM Cloud API Key" | ||
sensitive = true | ||
} | ||
|
||
variable "region" { | ||
type = string | ||
description = "Region to provision all resources created by this example" | ||
default = "us-south" | ||
} | ||
|
||
variable "prefix" { | ||
type = string | ||
description = "Prefix to append to all resources created by this example" | ||
default = "scc" | ||
} | ||
|
||
variable "resource_group" { | ||
type = string | ||
description = "The name of an existing resource group to provision resources in to. If not set a new resource group will be created using the prefix variable" | ||
default = null | ||
} | ||
|
||
variable "resource_tags" { | ||
type = list(string) | ||
description = "Optional list of tags to be added to created resources" | ||
default = [] | ||
} |
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,12 @@ | ||
terraform { | ||
required_version = ">= 1.3.0, <1.6.0" | ||
|
||
# Ensure that there is always 1 example locked into the lowest provider version of the range defined in the main | ||
# module's version.tf (usually a basic example), and 1 example that will always use the latest provider version. | ||
required_providers { | ||
ibm = { | ||
source = "IBM-Cloud/ibm" | ||
version = ">= 1.62.0" | ||
} | ||
} | ||
} |
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
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
Oops, something went wrong.