-
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.
- Loading branch information
Showing
12 changed files
with
113 additions
and
1 deletion.
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
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,3 @@ | ||
| locals { | ||
| _module_version = "1.12.0" | ||
| _module_version = "1.13.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 @@ | ||
| ../common/data.tf |
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 @@ | ||
| ../common/defaults.tf |
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,34 @@ | ||
| locals { | ||
| template_prefix = "aws_decription_tasks" | ||
| } | ||
|
|
||
| #--- | ||
| # generate splunk inputs file | ||
| #--- | ||
| data "template_file" "splunk_description" { | ||
| template = file("${path.module}/templates/${local.template_prefix}.conf.tpl") | ||
| vars = { | ||
| account_id = local.account_id | ||
| account_alias = local.account_alias | ||
| entry_uuid = random_uuid.splunk_description.result | ||
| region = local.region | ||
| api_list = join(",", local.api_values) | ||
| } | ||
| } | ||
|
|
||
| resource "random_uuid" "splunk_description" { | ||
| keepers = { | ||
| description = length(local.api_list) > 0 ? 1 : 0 | ||
| } | ||
| } | ||
|
|
||
| resource "null_resource" "splunk_description" { | ||
| count = length(local.api_list) > 0 ? 1 : 0 | ||
| provisioner "local-exec" { | ||
| command = "test -d setup || mkdir setup" | ||
| } | ||
| provisioner "local-exec" { | ||
| working_dir = "setup" | ||
| command = "echo '${data.template_file.splunk_description.rendered}' > ${local.template_prefix}.${local.account_id}.${local.config_region}.conf" | ||
| } | ||
| } |
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 @@ | ||
| /* | ||
| * # aws-inf-setup :: splunk-description | ||
| * | ||
| * This set up the Splunk input configuration files in setup/aws_description_tasks.conf | ||
| * for this account and region | ||
| * | ||
| * # Usage | ||
| * Here is a simple example, the one most commonly expected to be used. | ||
| * | ||
| * ```hcl | ||
| * module "splunk_description" { | ||
| * source = "git@github.e.it.census.gov:terraform-modules/aws-inf-setup.git//splunk-description" | ||
| * account_alias = "ma5-gov" | ||
| * | ||
| * ## optional | ||
| * # api_list = ["ec2_instances","ec2_volumes",] | ||
| * # api_interval = 3600 | ||
| * } | ||
| * ``` | ||
| */ | ||
|
|
||
| locals { | ||
| account_id = var.account_id != "" ? var.account_id : data.aws_caller_identity.current.account_id | ||
| region = data.aws_region.current.name | ||
| account_environment = data.aws_arn.current.partition == "aws-us-gov" ? "gov" : "ew" | ||
| # remap do2 to do1 for govcloud (undo this later when accounts are renamed in splunk) | ||
| account_alias = replace(var.account_alias, "do2", "do1") | ||
|
|
||
| description_defaults = local._defaults["splunk_descriptions"] | ||
| api_list = length(var.api_list) > 0 ? var.api_list : local.description_default["api_list"] | ||
| api_interval = var.api_interval > 0 ? var.api_interval : local.description_default["api_interval"] | ||
| api_values = [for x in local.api_list : format("%v/%v", v, local.api_interval)] | ||
|
|
||
| base_tags = { | ||
| "Organization" = "census:aditcio:csvd" | ||
| "boc:tf_module_version" = local._module_version | ||
| "boc:created_by" = "terraform" | ||
| } | ||
| } |
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 @@ | ||
| ../common/prefixes.tf |
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 @@ | ||
| [${account_alias}-description-${region}] | ||
| account = ${account_alias} | ||
| apis = ${api_list} | ||
| index = aws | ||
| regions = ${region} | ||
| sourcetype = aws:description |
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 @@ | ||
| ../common/variables.common.tf |
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 @@ | ||
| variable "api_list" { | ||
| description = "Splunk description input API list" | ||
| type = list(string) | ||
| default = [] | ||
| } | ||
|
|
||
| variable "api_interval" { | ||
| description = "Splunk description input retrieval interval" | ||
| type = number | ||
| default = 3600 | ||
| } |
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 @@ | ||
| ../common/version.tf |