feat(dash): SSL certificate
[csit.git] / fdio.infra.terraform / terraform-aws-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_application" {
11   source = "../terraform-aws-elastic-beanstalk-application"
12
13   # application
14   application_description                    = "FD.io CDASH"
15   application_name                           = "fdio-csit-dash-app"
16   appversion_lifecycle_service_role_arn      = ""
17   appversion_lifecycle_max_count             = 2
18   appversion_lifecycle_delete_source_from_s3 = false
19 }
20
21 module "elastic_beanstalk_environment" {
22   source = "../terraform-aws-elastic-beanstalk-environment"
23
24   # vpc
25   vpc_cidr_block           = "192.168.0.0/24"
26   vpc_enable_dns_hostnames = true
27   vpc_enable_dns_support   = true
28   vpc_instance_tenancy     = "default"
29
30   # subnet
31   subnet_availability_zone = "eu-central-1a"
32
33   # environment
34   environment_application            = module.elastic_beanstalk_application.application_name
35   environment_description            = module.elastic_beanstalk_application.application_description
36   environment_name                   = "fdio-csit-dash-env"
37   environment_solution_stack_name    = "64bit Amazon Linux 2 v3.4.3 running Python 3.8"
38   environment_tier                   = "WebServer"
39   environment_wait_for_ready_timeout = "25m"
40   environment_version_label          = ""
41
42   # aws:ec2:instances
43   instances_instance_types = "t3a.large"
44
45   # aws:ec2:vpc
46   associate_public_ip_address = true
47   elb_scheme                  = "public"
48
49   # aws:elbv2:listener:default
50   default_listener_enabled = true
51
52   # aws:elasticbeanstalk:environment
53   environment_loadbalancer_type               = "classic"
54   environment_loadbalancer_ssl_certificate_id = "arn:aws:acm:eu-central-1:407116685360:certificate/737ad419-36f1-460d-919a-9110b0aac26a"
55
56   # aws:elasticbeanstalk:environment:process:default
57   environment_process_default_healthcheck_interval      = 10
58   environment_process_default_healthy_threshold_count   = 3
59   environment_process_default_port                      = 5000
60   environment_process_default_unhealthy_threshold_count = 3
61
62   # aws:autoscaling:updatepolicy:rollingupdate
63   autoscaling_updatepolicy_rolling_update_enabled  = true
64   autoscaling_updatepolicy_rolling_update_type     = "Immutable"
65   autoscaling_updatepolicy_min_instance_in_service = 1
66
67   # aws:elasticbeanstalk:command
68   command_deployment_policy = "Rolling"
69
70   # aws:autoscaling:updatepolicy:rollingupdate
71   updatepolicy_max_batch_size = 1
72
73   # aws:elasticbeanstalk:healthreporting:system
74   healthreporting_system_type = "enhanced"
75
76   # aws:elasticbeanstalk:managedactions
77   managedactions_managed_actions_enabled = true
78   managedactions_preferred_start_time    = "Sun:10:00"
79
80   # aws:elasticbeanstalk:managedactions:platformupdate
81   managedactions_platformupdate_update_level             = "minor"
82   managedactions_platformupdate_instance_refresh_enabled = true
83
84   # aws:autoscaling:asg
85   autoscaling_asg_minsize = 1
86   autoscaling_asg_maxsize = 2
87
88   # aws:autoscaling:trigger
89   autoscaling_trigger_measure_name                 = "CPUUtilization"
90   autoscaling_trigger_statistic                    = "Average"
91   autoscaling_trigger_unit                         = "Percent"
92   autoscaling_trigger_lower_threshold              = 20
93   autoscaling_trigger_lower_breach_scale_increment = -1
94   autoscaling_trigger_upper_threshold              = 80
95   autoscaling_trigger_upper_breach_scale_increment = 1
96
97   # aws:elasticbeanstalk:hostmanager
98   hostmanager_log_publication_control = true
99
100   # aws:elasticbeanstalk:cloudwatch:logs
101   cloudwatch_logs_stream_logs         = true
102   cloudwatch_logs_delete_on_terminate = true
103   cloudwatch_logs_retention_in_days   = 3
104
105   # aws:elasticbeanstalk:cloudwatch:logs:health
106   cloudwatch_logs_health_health_streaming_enabled = true
107   cloudwatch_logs_health_delete_on_terminate      = true
108   cloudwatch_logs_health_retention_in_days        = 3
109
110   environment_type = "LoadBalanced"
111
112   # aws:elasticbeanstalk:application:environment
113   environment_variables = {
114     "AWS_ACCESS_KEY_ID"     = data.vault_generic_secret.fdio_docs.data["access_key"]
115     "AWS_SECRET_ACCESS_KEY" = data.vault_generic_secret.fdio_docs.data["secret_key"]
116     "AWS_DEFAULT_REGION"    = data.vault_generic_secret.fdio_docs.data["region"]
117   }
118 }