Skip to content

Commit f1bdca4

Browse files
author
Sean Sundberg
authored
Moves flow-log logic and variables to separate module (#32)
Signed-off-by: Sean Sundberg <[email protected]>
1 parent 5f739f1 commit f1bdca4

File tree

6 files changed

+0
-100
lines changed

6 files changed

+0
-100
lines changed

main.tf

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,6 @@ locals {
1414
provision_cidr = var.provision && local.ipv4_cidr_provided
1515
}
1616

17-
resource null_resource print_values {
18-
provisioner "local-exec" {
19-
command = "echo 'Bucket name: ${var.flow_log_cos_bucket_name != null ? var.flow_log_cos_bucket_name : ""}'"
20-
}
21-
provisioner "local-exec" {
22-
command = "echo 'Auth policy id: ${var.auth_id}'"
23-
}
24-
}
25-
2617
resource ibm_is_vpc vpc {
2718
count = var.provision ? 1 : 0
2819

@@ -128,16 +119,3 @@ resource ibm_is_security_group_rule private_dns_2 {
128119
port_max = 53
129120
}
130121
}
131-
132-
resource ibm_is_flow_log flowlog_instance {
133-
count = length(var.flow_log_cos_bucket_name) > 0 ? 1 : 0
134-
depends_on = [ibm_is_vpc.vpc, null_resource.print_values]
135-
136-
name = "${local.vpc_name}-flowlog"
137-
active = true
138-
//target can be VPC or Virtual Server Instance or Subnet or Primary Network Interface or Secondary Network Interface
139-
target = data.ibm_is_vpc.vpc.id
140-
resource_group = var.resource_group_id
141-
storage_bucket = var.flow_log_cos_bucket_name
142-
}
143-

module.yaml

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,6 @@ versions:
1111
refs:
1212
- source: github.com/cloud-native-toolkit/terraform-ibm-resource-group
1313
version: ">= 2.1.0"
14-
- id: cos_bucket
15-
refs:
16-
- source: github.com/cloud-native-toolkit/terraform-ibm-object-storage-bucket
17-
version: ">= 0.0.1"
18-
optional: true
19-
- id: auth
20-
refs: []
21-
optional: true
2214
variables:
2315
- name: resource_group_id
2416
moduleRef:
@@ -36,13 +28,3 @@ versions:
3628
scope: global
3729
- name: ibmcloud_api_key
3830
scope: global
39-
- name: flow_log_cos_bucket_name
40-
moduleRef:
41-
id: cos_bucket
42-
output: bucket_name
43-
optional: true
44-
- name: auth_id
45-
moduleRef:
46-
id: auth
47-
output: id
48-
optional: true

test/stages/stage1-cos.tf

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

test/stages/stage1-flow-log-auth.tf

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

test/stages/stage2-vpc.tf

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,4 @@ module "dev_vpc" {
88
ibmcloud_api_key = var.ibmcloud_api_key
99
address_prefix_count = var.address_prefix_count
1010
address_prefixes = tolist(setsubtract(split(",", var.address_prefixes), [""]))
11-
auth_id = module.flow-log-auth.id
12-
flow_log_cos_bucket_name = module.dev_cos_bucket.bucket_name
1311
}

variables.tf

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,6 @@ variable "provision" {
3636
default = true
3737
}
3838

39-
variable "flow_log_cos_bucket_name" {
40-
type = string
41-
description = "Cloud Object Storage bucket id for flow logs (optional)"
42-
default = ""
43-
}
44-
4539
variable "address_prefix_count" {
4640
type = number
4741
description = "The number of ipv4_cidr_blocks"
@@ -53,9 +47,3 @@ variable "address_prefixes" {
5347
description = "List of ipv4 cidr blocks for the address prefixes (e.g. ['10.10.10.0/24']). If you are providing cidr blocks then a value must be provided for each of the subnets. If you don't provide cidr blocks for each of the subnets then values will be generated using the {ipv4_address_count} value."
5448
default = []
5549
}
56-
57-
variable "auth_id" {
58-
type = string
59-
description = "The id of the authorization policy that allows the Flow Log to access the Object Storage bucket. This is optional and provided to sequence the authorization before the flow log creation."
60-
default = ""
61-
}

0 commit comments

Comments
 (0)