01b235162d98944ff2d1ef92848515a2a9dbdd56
[csit.git] / fdio.infra.terraform / 1n_aws_t3 / fdio-csit-dash-env / main.tf
1 data "vault_generic_secret" "fdio_docs" {
2   path = "kv/secret/data/etl/fdio_docs"
3 }
4
5 data "vault_aws_access_credentials" "creds" {
6   backend = "${var.vault_name}-path"
7   role    = "${var.vault_name}-role"
8 }
9
10 module "elastic_beanstalk_environment" {
11   source = "../"
12
13   # vpc
14   vpc_cidr_block           = "192.168.0.0/24"
15   vpc_enable_dns_hostnames = true
16   vpc_enable_dns_support   = true
17   vpc_instance_tenancy     = "default"
18
19   # subnet
20   subnet_availability_zone = "us-east-1a"
21
22   # application
23   application_description                    = "FD.io CSIT Results Dashboard"
24   application_name                           = "fdio-csit-dash-app"
25   appversion_lifecycle_service_role_arn      = ""
26   appversion_lifecycle_max_count             = 2
27   appversion_lifecycle_delete_source_from_s3 = false
28
29   # environment
30   environment_description            = "FD.io CSIT Results Dashboard"
31   environment_name                   = "fdio-csit-dash-env"
32   environment_solution_stack_name    = "64bit Amazon Linux 2 v3.3.11 running Python 3.8"
33   environment_tier                   = "WebServer"
34   environment_wait_for_ready_timeout = "20m"
35   environment_version_label          = ""
36
37   # aws:ec2:instances
38   instances_instance_types = "t3a.2xlarge"
39
40   # aws:ec2:vpc
41   associate_public_ip_address = true
42   elb_scheme                  = "public"
43
44   # aws:elbv2:listener:default
45   default_listener_enabled = true
46
47   # aws:elasticbeanstalk:environment
48   environment_loadbalancer_type = "network"
49
50   # aws:elasticbeanstalk:environment:process:default
51   environment_process_default_healthcheck_interval      = 10
52   environment_process_default_healthy_threshold_count   = 3
53   environment_process_default_port                      = 5000
54   environment_process_default_unhealthy_threshold_count = 3
55
56   # aws:elasticbeanstalk:healthreporting:system
57   healthreporting_system_type = "enhanced"
58
59   # aws:elasticbeanstalk:managedactions
60   managedactions_managed_actions_enabled = true
61   managedactions_preferred_start_time    = "Sun:10:00"
62
63   # aws:elasticbeanstalk:managedactions:platformupdate
64   managedactions_platformupdate_update_level             = "minor"
65   managedactions_platformupdate_instance_refresh_enabled = true
66
67   # aws:autoscaling:asg
68   autoscaling_asg_minsize = 1
69   autoscaling_asg_maxsize = 2
70
71   # aws:autoscaling:trigger
72   autoscaling_trigger_measure_name                 = "CPUUtilization"
73   autoscaling_trigger_statistic                    = "Average"
74   autoscaling_trigger_unit                         = "Percent"
75   autoscaling_trigger_lower_threshold              = 20
76   autoscaling_trigger_lower_breach_scale_increment = -1
77   autoscaling_trigger_upper_threshold              = 80
78   autoscaling_trigger_upper_breach_scale_increment = 1
79
80   # aws:elasticbeanstalk:hostmanager
81   hostmanager_log_publication_control = true
82
83   # aws:elasticbeanstalk:cloudwatch:logs
84   cloudwatch_logs_stream_logs         = true
85   cloudwatch_logs_delete_on_terminate = true
86   cloudwatch_logs_retention_in_days   = 3
87
88   # aws:elasticbeanstalk:cloudwatch:logs:health
89   cloudwatch_logs_health_health_streaming_enabled = true
90   cloudwatch_logs_health_delete_on_terminate      = true
91   cloudwatch_logs_health_retention_in_days        = 3
92
93   environment_type = "LoadBalanced"
94
95   # aws:elasticbeanstalk:application:environment
96   environment_variables = {
97     "AWS_ACCESS_KEY_ID"     = data.vault_generic_secret.fdio_docs.data["access_key"]
98     "AWS_SECRET_ACCESS_KEY" = data.vault_generic_secret.fdio_docs.data["secret_key"]
99     "AWS_DEFAULT_REGION"    = data.vault_generic_secret.fdio_docs.data["region"]
100   }
101 }