Skip to content

Commit

Permalink
Fix linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
danischm committed Apr 20, 2024
1 parent 865027d commit 60d6bed
Show file tree
Hide file tree
Showing 7 changed files with 278 additions and 286 deletions.
499 changes: 248 additions & 251 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/network_groups/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
This example will create a new `MyNetworkGroup1`, `MyNetworkGroup2` network-group objects that contains two objects:
> `MyNetworkGroup1`:
- newly created `MyHost1` host object
- already existing `any-ipv4` network object
- already existing `any-ipv4` network object
> `MyNetworkGroup2`:
- newly created `MyNetworkGroup1` network-group object
- newly created `MyHost2` host object
Expand Down
34 changes: 15 additions & 19 deletions existing.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ locals {
data_accesspolicies = [for obj in try(local.data_existing.fmc.domains[0].access_policies, []) : obj.name]
data_ftdnatpolicies = [for obj in try(local.data_existing.fmc.domains[0].ftd_nat_policies, []) : obj.name]
data_ipspolicies = [for obj in try(local.data_existing.fmc.domains[0].ips_policies, []) : obj.name]
data_filepolicies = [for obj in try(local.data_existing.fmc.domains[0].file_policies, []) : obj.name]
data_hosts = [for obj in try(local.data_existing.fmc.domains[0].objects.hosts, []) : obj.name]
data_networks = [for obj in try(local.data_existing.fmc.domains[0].objects.networks, []) : obj.name]
#data_filepolicies = [for obj in try(local.data_existing.fmc.domains[0].file_policies, []) : obj.name]
data_hosts = [for obj in try(local.data_existing.fmc.domains[0].objects.hosts, []) : obj.name]
data_networks = [for obj in try(local.data_existing.fmc.domains[0].objects.networks, []) : obj.name]
#data_ranges = []
data_networkgroups = [for obj in try(local.data_existing.fmc.domains[0].objects.network_groups, []) : obj.name]
data_ports = [for obj in try(local.data_existing.fmc.domains[0].objects.ports, []) : obj.name]
data_portgroups = [for obj in try(local.data_existing.fmc.domains[0].objects.port_groups, []) : obj.name]
#data_icmpv_4s = []
data_securityzones = [for obj in try(local.data_existing.fmc.domains[0].objects.security_zones, []) : obj.name]
data_urls = [for obj in try(local.data_existing.fmc.domains[0].objects.urls, []) : obj.name]
data_syslogalerts = []
data_securityzones = [for obj in try(local.data_existing.fmc.domains[0].objects.security_zones, []) : obj.name]
data_urls = [for obj in try(local.data_existing.fmc.domains[0].objects.urls, []) : obj.name]
#data_syslogalerts = []
data_sgts = [for obj in try(local.data_existing.fmc.domains[0].objects.sgts, []) : obj.name]
data_dynamicobjects = [for obj in try(local.data_existing.fmc.domains[0].objects.dynamic_objects, []) : obj.name]

Expand Down Expand Up @@ -119,23 +119,23 @@ data "fmc_ips_policies" "ips_policy" {
name = each.key
}

data "fmc_file_policies" "file_policy" {
for_each = toset(local.data_filepolicies)
# data "fmc_file_policies" "file_policy" {
# for_each = toset(local.data_filepolicies)

name = each.key
}
# name = each.key
# }

data "fmc_devices" "device" {
for_each = toset(local.data_devices)

name = each.key
}

data "fmc_device_cluster" "cluster" {
for_each = toset(local.data_clusters)
# data "fmc_device_cluster" "cluster" {
# for_each = toset(local.data_clusters)

name = each.key
}
# name = each.key
# }

data "fmc_device_physical_interfaces" "physical_interface" {
for_each = local.map_interfaces
Expand Down Expand Up @@ -173,8 +173,4 @@ data "fmc_url_objects" "url" {
name = each.key
}

data "fmc_syslog_alerts" "syslogalert" {
for_each = toset(local.data_syslogalerts)

name = each.key
}
#
3 changes: 0 additions & 3 deletions fmc_networkobject.tf
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,6 @@ locals {
} if !contains(keys(local.map_networkobjects_l5), object.name) && !contains(local.res_networkgroups_l5_hlp[domains.name][object.name], false)
]
])

res_networkgroups = local.res_networkgroups_l1

}

resource "fmc_network_group_objects" "networkgroup_l1" {
Expand Down
14 changes: 3 additions & 11 deletions merge.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,12 @@ locals {
for file in fileset(".", "${dir}/*.{yml,yaml}") : file(file)
]
])

yaml_strings_files = [
for file in var.yaml_files : file(file)
]
model_strings = length(keys(var.model)) != 0 ? [yamlencode(var.model)] : []
user_defaults = { "defaults" : try(lookup(yamldecode(data.utils_yaml_merge.model.output), "defaults"), {}) }
defaults = lookup(yamldecode(data.utils_yaml_merge.defaults.output), "defaults")
user_modules = { "modules" : try(lookup(yamldecode(data.utils_yaml_merge.model.output), "modules"), {}) }
#modules = lookup(yamldecode(data.utils_yaml_merge.modules.output), "modules")
model = yamldecode(data.utils_yaml_merge.model.output)
user_defaults = { "defaults" : try(yamldecode(data.utils_yaml_merge.model.output)["defaults"], {}) }
defaults = yamldecode(data.utils_yaml_merge.defaults.output)["defaults"]
model = yamldecode(data.utils_yaml_merge.model.output)
}

data "utils_yaml_merge" "model" {
Expand All @@ -31,10 +27,6 @@ data "utils_yaml_merge" "defaults" {
input = [file("${path.module}/defaults/defaults.yaml"), yamlencode(local.user_defaults)]
}

#data "utils_yaml_merge" "modules" {
# input = [file("${path.module}/defaults/modules.yaml"), yamlencode(local.user_modules)]
#}

resource "local_sensitive_file" "defaults" {
count = var.write_default_values_file != "" ? 1 : 0
content = data.utils_yaml_merge.defaults.output
Expand Down
10 changes: 10 additions & 0 deletions templates/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
terraform {
required_version = ">= 1.3.0"

required_providers {
local = {
source = "hashicorp/local"
version = ">= 2.3.0"
}
}
}
2 changes: 1 addition & 1 deletion versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
fmc = {
source = "CiscoDevNet/fmc"
version = "1.4.8"
version = ">= 1.4.8"
}
utils = {
source = "netascode/utils"
Expand Down

0 comments on commit 60d6bed

Please sign in to comment.