|
| 1 | +provider "aws" { |
| 2 | + max_retries = 1337 |
| 3 | + region = "eu-central-1" |
| 4 | +} |
| 5 | + |
| 6 | +resource "aws_vpc" "vpc" { |
| 7 | + cidr_block = "172.16.0.0/16" |
| 8 | + tags = { |
| 9 | + Name = "Test-VPC" |
| 10 | + } |
| 11 | +} |
| 12 | + |
| 13 | +resource "aws_subnet" "subnet" { |
| 14 | + vpc_id = aws_vpc.vpc.id |
| 15 | + cidr_block = cidrsubnet(aws_vpc.vpc.cidr_block, 8, 10) |
| 16 | + availability_zone = "eu-central-1a" |
| 17 | + tags = { |
| 18 | + Name = "Private" |
| 19 | + } |
| 20 | +} |
| 21 | + |
| 22 | +resource "aws_cloudwatch_log_group" "example_logs" { |
| 23 | + name = "MyExampleService" |
| 24 | + retention_in_days = 1 |
| 25 | +} |
| 26 | + |
| 27 | +resource "aws_security_group" "functionbeat_securitygroup" { |
| 28 | + name = "Functionbeat" |
| 29 | + vpc_id = aws_vpc.vpc.id |
| 30 | + |
| 31 | + egress { |
| 32 | + from_port = 443 |
| 33 | + protocol = "tcp" |
| 34 | + to_port = 443 |
| 35 | + description = "HTTPS" |
| 36 | + cidr_blocks = ["0.0.0.0/0"] |
| 37 | + } |
| 38 | +} |
| 39 | + |
| 40 | +module "functionbeat" { |
| 41 | + source = "../" |
| 42 | + |
| 43 | + application_name = "crazy-test-module" |
| 44 | + functionbeat_version = "7.17.1" |
| 45 | + |
| 46 | + lambda_config = { |
| 47 | + name = "my-kibana-exporter" |
| 48 | + |
| 49 | + vpc_config = { |
| 50 | + vpc_id = aws_vpc.vpc.id |
| 51 | + subnet_ids = [aws_subnet.subnet.id] |
| 52 | + security_group_ids = [aws_security_group.functionbeat_securitygroup.id] |
| 53 | + } |
| 54 | + |
| 55 | + output_logstash = { |
| 56 | + hosts = ["10.0.0.1:5044", "10.0.0.2:5044"] |
| 57 | + ssl.enabled = false |
| 58 | + } |
| 59 | + } |
| 60 | + |
| 61 | + loggroup_name = aws_cloudwatch_log_group.example_logs.name |
| 62 | + |
| 63 | + fb_extra_configuration = { |
| 64 | + fields = { |
| 65 | + env = "test", |
| 66 | + foo = "bar" |
| 67 | + } |
| 68 | + setup = { |
| 69 | + "template.settings" = { |
| 70 | + "index.number_of_shards" : 1 |
| 71 | + } |
| 72 | + ilm = { |
| 73 | + enabled : true |
| 74 | + rollover_alias : "my-alias" |
| 75 | + pattern : "{now/d}-000001" |
| 76 | + policy_name : "index_curation" |
| 77 | + } |
| 78 | + } |
| 79 | + logging = { |
| 80 | + to_syslog : false |
| 81 | + to_eventlog : false |
| 82 | + } |
| 83 | + processors = [ |
| 84 | + { |
| 85 | + add_cloud_metadata : null |
| 86 | + }, |
| 87 | + { |
| 88 | + add_fields = { |
| 89 | + fields = { |
| 90 | + id = "574734885120952459" |
| 91 | + name = "myproject" |
| 92 | + } |
| 93 | + target = "project" |
| 94 | + } |
| 95 | + } |
| 96 | + ] |
| 97 | + } |
| 98 | + fb_extra_tags = ["webserver", "testme"] |
| 99 | +} |
0 commit comments