aboutsummaryrefslogtreecommitdiffstats
path: root/fdio.infra.terraform/terraform-aws-elastic-beanstalk-application
diff options
context:
space:
mode:
authorPeter Mikus <pmikus@cisco.com>2022-03-16 16:42:57 +0100
committerPeter Mikus <pmikus@cisco.com>2022-03-17 13:06:15 +0000
commit6c8ca0ad2a9fe0bab2033e41c6b056226cf9a856 (patch)
tree532941f4850185b3c174de1696d58357bacdc0f7 /fdio.infra.terraform/terraform-aws-elastic-beanstalk-application
parent273a9aa49bba07740b7f7e15277d05f334ab6cc1 (diff)
feat(dash): Terraform AWS Beanstalk split
Signed-off-by: Peter Mikus <pmikus@cisco.com> Change-Id: I6a9f54be0f734cd267c7ea5aa7f9933e04a8e139
Diffstat (limited to 'fdio.infra.terraform/terraform-aws-elastic-beanstalk-application')
-rw-r--r--fdio.infra.terraform/terraform-aws-elastic-beanstalk-application/README.md41
-rw-r--r--fdio.infra.terraform/terraform-aws-elastic-beanstalk-application/example/main.tf4
-rw-r--r--fdio.infra.terraform/terraform-aws-elastic-beanstalk-application/example/output.tf9
-rw-r--r--fdio.infra.terraform/terraform-aws-elastic-beanstalk-application/example/providers.tf3
-rw-r--r--fdio.infra.terraform/terraform-aws-elastic-beanstalk-application/example/variables.tf11
-rw-r--r--fdio.infra.terraform/terraform-aws-elastic-beanstalk-application/example/versions.tf9
-rw-r--r--fdio.infra.terraform/terraform-aws-elastic-beanstalk-application/main.tf21
-rw-r--r--fdio.infra.terraform/terraform-aws-elastic-beanstalk-application/output.tf7
-rw-r--r--fdio.infra.terraform/terraform-aws-elastic-beanstalk-application/variables.tf29
-rw-r--r--fdio.infra.terraform/terraform-aws-elastic-beanstalk-application/versions.tf9
10 files changed, 143 insertions, 0 deletions
diff --git a/fdio.infra.terraform/terraform-aws-elastic-beanstalk-application/README.md b/fdio.infra.terraform/terraform-aws-elastic-beanstalk-application/README.md
new file mode 100644
index 0000000000..d149d90038
--- /dev/null
+++ b/fdio.infra.terraform/terraform-aws-elastic-beanstalk-application/README.md
@@ -0,0 +1,41 @@
+<!-- BEGIN_TF_DOCS -->
+## Requirements
+
+| Name | Version |
+|------|---------|
+| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.1.4 |
+| <a name="requirement_aws"></a> [aws](#requirement\_aws) | ~> 4.3.0 |
+
+## Providers
+
+| Name | Version |
+|------|---------|
+| <a name="provider_aws"></a> [aws](#provider\_aws) | ~> 4.3.0 |
+
+## Modules
+
+No modules.
+
+## Resources
+
+| Name | Type |
+|------|------|
+| [aws_elastic_beanstalk_application.application](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/elastic_beanstalk_application) | resource |
+
+## Inputs
+
+| Name | Description | Type | Default | Required |
+|------|-------------|------|---------|:--------:|
+| <a name="input_application_description"></a> [application\_description](#input\_application\_description) | Short description of the application. | `string` | `"Beanstalk Application"` | no |
+| <a name="input_application_name"></a> [application\_name](#input\_application\_name) | The name of the application, must be unique within account. | `string` | `"Beanstalk"` | no |
+| <a name="input_appversion_lifecycle_delete_source_from_s3"></a> [appversion\_lifecycle\_delete\_source\_from\_s3](#input\_appversion\_lifecycle\_delete\_source\_from\_s3) | Whether to delete application versions from S3 source. | `bool` | `false` | no |
+| <a name="input_appversion_lifecycle_max_count"></a> [appversion\_lifecycle\_max\_count](#input\_appversion\_lifecycle\_max\_count) | The max number of application versions to keep. | `number` | `2` | no |
+| <a name="input_appversion_lifecycle_service_role_arn"></a> [appversion\_lifecycle\_service\_role\_arn](#input\_appversion\_lifecycle\_service\_role\_arn) | The service role ARN to use for application version cleanup. If left empty, the `appversion_lifecycle` block will not be created. | `string` | `""` | no |
+
+## Outputs
+
+| Name | Description |
+|------|-------------|
+| <a name="output_application_description"></a> [application\_description](#output\_application\_description) | n/a |
+| <a name="output_application_name"></a> [application\_name](#output\_application\_name) | n/a |
+<!-- END_TF_DOCS --> \ No newline at end of file
diff --git a/fdio.infra.terraform/terraform-aws-elastic-beanstalk-application/example/main.tf b/fdio.infra.terraform/terraform-aws-elastic-beanstalk-application/example/main.tf
new file mode 100644
index 0000000000..410d1abc59
--- /dev/null
+++ b/fdio.infra.terraform/terraform-aws-elastic-beanstalk-application/example/main.tf
@@ -0,0 +1,4 @@
+module "elastic_beanstalk_application" {
+ source = "../"
+ application_description = var.application_description
+}
diff --git a/fdio.infra.terraform/terraform-aws-elastic-beanstalk-application/example/output.tf b/fdio.infra.terraform/terraform-aws-elastic-beanstalk-application/example/output.tf
new file mode 100644
index 0000000000..290e2a1c5a
--- /dev/null
+++ b/fdio.infra.terraform/terraform-aws-elastic-beanstalk-application/example/output.tf
@@ -0,0 +1,9 @@
+output "elastic_beanstalk_application_name" {
+ value = module.elastic_beanstalk_application.application_name
+ description = "Elastic Beanstalk Application name"
+}
+
+output "elastic_beanstalk_application_description" {
+ value = module.elastic_beanstalk_application.application_description
+ description = "Elastic Beanstalk Application description"
+}
diff --git a/fdio.infra.terraform/terraform-aws-elastic-beanstalk-application/example/providers.tf b/fdio.infra.terraform/terraform-aws-elastic-beanstalk-application/example/providers.tf
new file mode 100644
index 0000000000..5ff54f0d65
--- /dev/null
+++ b/fdio.infra.terraform/terraform-aws-elastic-beanstalk-application/example/providers.tf
@@ -0,0 +1,3 @@
+provider "aws" {
+ region = var.region
+} \ No newline at end of file
diff --git a/fdio.infra.terraform/terraform-aws-elastic-beanstalk-application/example/variables.tf b/fdio.infra.terraform/terraform-aws-elastic-beanstalk-application/example/variables.tf
new file mode 100644
index 0000000000..12af1d64c6
--- /dev/null
+++ b/fdio.infra.terraform/terraform-aws-elastic-beanstalk-application/example/variables.tf
@@ -0,0 +1,11 @@
+variable "region" {
+ description = "AWS Region."
+ type = string
+ default = "us-east-1"
+}
+
+variable "application_description" {
+ description = "Short description of the application."
+ type = string
+ default = "Beanstalk Application"
+}
diff --git a/fdio.infra.terraform/terraform-aws-elastic-beanstalk-application/example/versions.tf b/fdio.infra.terraform/terraform-aws-elastic-beanstalk-application/example/versions.tf
new file mode 100644
index 0000000000..af1be4a4e1
--- /dev/null
+++ b/fdio.infra.terraform/terraform-aws-elastic-beanstalk-application/example/versions.tf
@@ -0,0 +1,9 @@
+terraform {
+ required_providers {
+ aws = {
+ source = "hashicorp/aws"
+ version = ">= 4.3.0"
+ }
+ }
+ required_version = ">= 1.1.4"
+}
diff --git a/fdio.infra.terraform/terraform-aws-elastic-beanstalk-application/main.tf b/fdio.infra.terraform/terraform-aws-elastic-beanstalk-application/main.tf
new file mode 100644
index 0000000000..909d6fca4d
--- /dev/null
+++ b/fdio.infra.terraform/terraform-aws-elastic-beanstalk-application/main.tf
@@ -0,0 +1,21 @@
+locals {
+ tags = {
+ "Name" = "${var.application_name}"
+ "Environment" = "${var.application_name}"
+ }
+}
+
+resource "aws_elastic_beanstalk_application" "application" {
+ name = var.application_name
+ description = var.application_description
+ tags = local.tags
+
+ dynamic "appversion_lifecycle" {
+ for_each = var.appversion_lifecycle_service_role_arn != "" ? ["true"] : []
+ content {
+ service_role = var.appversion_lifecycle_service_role_arn
+ max_count = var.appversion_lifecycle_max_count
+ delete_source_from_s3 = var.appversion_lifecycle_delete_source_from_s3
+ }
+ }
+}
diff --git a/fdio.infra.terraform/terraform-aws-elastic-beanstalk-application/output.tf b/fdio.infra.terraform/terraform-aws-elastic-beanstalk-application/output.tf
new file mode 100644
index 0000000000..ce7f978e53
--- /dev/null
+++ b/fdio.infra.terraform/terraform-aws-elastic-beanstalk-application/output.tf
@@ -0,0 +1,7 @@
+output "application_name" {
+ value = aws_elastic_beanstalk_application.application.name
+}
+
+output "application_description" {
+ value = aws_elastic_beanstalk_application.application.description
+} \ No newline at end of file
diff --git a/fdio.infra.terraform/terraform-aws-elastic-beanstalk-application/variables.tf b/fdio.infra.terraform/terraform-aws-elastic-beanstalk-application/variables.tf
new file mode 100644
index 0000000000..38090c99b5
--- /dev/null
+++ b/fdio.infra.terraform/terraform-aws-elastic-beanstalk-application/variables.tf
@@ -0,0 +1,29 @@
+variable "application_description" {
+ description = "Short description of the application."
+ type = string
+ default = "Beanstalk Application"
+}
+
+variable "application_name" {
+ description = "The name of the application, must be unique within account."
+ type = string
+ default = "Beanstalk"
+}
+
+variable "appversion_lifecycle_service_role_arn" {
+ description = "The service role ARN to use for application version cleanup. If left empty, the `appversion_lifecycle` block will not be created."
+ type = string
+ default = ""
+}
+
+variable "appversion_lifecycle_max_count" {
+ description = "The max number of application versions to keep."
+ type = number
+ default = 2
+}
+
+variable "appversion_lifecycle_delete_source_from_s3" {
+ description = "Whether to delete application versions from S3 source."
+ type = bool
+ default = false
+}
diff --git a/fdio.infra.terraform/terraform-aws-elastic-beanstalk-application/versions.tf b/fdio.infra.terraform/terraform-aws-elastic-beanstalk-application/versions.tf
new file mode 100644
index 0000000000..66b9c17f9b
--- /dev/null
+++ b/fdio.infra.terraform/terraform-aws-elastic-beanstalk-application/versions.tf
@@ -0,0 +1,9 @@
+terraform {
+ required_providers {
+ aws = {
+ source = "hashicorp/aws"
+ version = "~> 4.3.0"
+ }
+ }
+ required_version = ">= 1.1.4"
+}