Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Terraform base setup for ECS infrastructure #44

Merged
merged 1 commit into from
Jan 9, 2020

Conversation

smaniotto
Copy link
Contributor

This is a configuration to create an ECS cluster, database, bucket and all underlying structure to run a backend+frontend application. There is a README file that explains in more details how to use this configuration.

There are a few TODO comments that have to be addressed in the near future, but with this configuration we're already able to setup an infrastructure without the updates.

For mobile applications, that don't require a frontend, we still have to manually remove the frontend service.

Comment on lines +80 to +85
database = {
username = module.database.db_username,
password = module.database.db_password,
hostname = module.database.db_hostname,
name = module.database.db_name,
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I didn't know that we can pass a object

django_debug: "False",
app_bucket: var.app_bucket,
django_secret_key: var.backend_secret_key,
django_allowed_hosts: "*,",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should not this configs be added in the variables.tf?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely. I didn't work much on this because of issue #45 and I think that env vars should work better with Terraform local values (https://www.terraform.io/docs/configuration/locals.html) instead of passing variables around, maybe as an object/hashmap. Can it be added as a future improvement?

Comment on lines +34 to +39
vars = merge(var.container_env_vars, {
aws_region = var.region
container_name = "${var.project_name}-${var.alias_name}-${var.environment}"
cloudwatch_log_group = aws_cloudwatch_log_group.logs.name
container_image = "${aws_ecr_repository.ecr_repo.repository_url}:latest"
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏

@smaniotto smaniotto merged commit 7ebbc8e into master Jan 9, 2020
@smaniotto smaniotto deleted the bernardo/terraform branch January 9, 2020 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants