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

[Issue #2472] Terraform in ECS #2480

Merged
merged 14 commits into from
Oct 16, 2024
Merged

[Issue #2472] Terraform in ECS #2480

merged 14 commits into from
Oct 16, 2024

Conversation

coilysiren
Copy link
Collaborator

@coilysiren coilysiren commented Oct 15, 2024

Summary

Contributes to, but does not solve, #2472

Time to review: 10 mins

Changes proposed

Adds a new ECS service that contains:

  • bin folder
  • infra folder
  • Makefile

I plan on using this ECS service to deploy terraform from inside of our VPC

Context for reviewers

95% of this PR is copy paste, which is just how it is.

The parts that are specific to this PR are:

  • .dockerignore
  • ecs-terraform/Dockerfile
  • ecs-terraform/Makefile

@coilysiren coilysiren changed the title initial checkin Terraform in ECS Oct 15, 2024
@github-actions github-actions bot added the ci/cd label Oct 15, 2024
@github-actions github-actions bot added the shell label Oct 15, 2024
@github-actions github-actions bot removed the shell label Oct 15, 2024
@coilysiren coilysiren changed the title Terraform in ECS [Issue #2472] Terraform in ECS Oct 16, 2024
Comment on lines +1 to +3
node_modules
**/.terraform/**
.git
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The build was pulling in all the .terraform files, which made the build huge. Like 10 GB

Comment on lines +7 to +9
COPY --from=top-level-directory bin /app/bin
COPY --from=top-level-directory infra /app/infra
COPY --from=top-level-directory Makefile /app/Makefile
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fancy new docker features here, ability to pull from a context above your current folder

@@ -0,0 +1,20 @@
data "external" "account_ids_by_name" {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

copy paste

@@ -0,0 +1,7 @@
module "dev_config" {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

copy paste and snipped

@@ -0,0 +1,7 @@
module "staging_config" {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

copy paste and snipped

@@ -0,0 +1,7 @@
module "prod_config" {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

copy paste and snipped

@@ -0,0 +1,31 @@
output "app_name" {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

copy paste

@@ -0,0 +1,60 @@
locals {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

copy paste with slight modifications

@@ -0,0 +1,22 @@
variable "app_name" {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

copy paste and snipped

@@ -0,0 +1,11 @@
output "service_config" {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

copy paste and snipped

@@ -0,0 +1,17 @@
locals {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

copy paste

@@ -0,0 +1,59 @@
data "aws_iam_role" "github_actions" {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

copy paste

@@ -0,0 +1,56 @@
# Make the "image_tag" variable optional so that "terraform plan"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

copy paste

@@ -0,0 +1,107 @@
# docs: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

copy paste from the analytics module, which also is "triggered only" (eg. no web server)

@@ -0,0 +1,24 @@
output "service_endpoint" {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

copy paste

@@ -0,0 +1,16 @@
module "secrets" {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

copy paste

Comment on lines +33 to +37
build:
docker buildx build \
--build-context top-level-directory=../ \
--tag $(notdir $(shell pwd)):latest \
.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fancy

@coilysiren coilysiren marked this pull request as ready for review October 16, 2024 20:28
Copy link
Collaborator

@mdragon mdragon left a comment

Choose a reason for hiding this comment

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

3 files you had us focus on look good.

@coilysiren coilysiren merged commit d227b92 into main Oct 16, 2024
7 checks passed
@coilysiren coilysiren deleted the kai/terraform-in-ecs branch October 16, 2024 20:47
coilysiren added a commit that referenced this pull request Oct 25, 2024
## Summary

Relates to #2472, undos
#2480

### Time to review: __0.1 mins__

## Changes proposed

Removes all the ecs-terraform stuff

## Context for reviewers

I spent more time on this than my (self imposed) timebox, so I'm
swapping to the VPN route instead. If nothing else, it was in fact fun
to work on. What is engineering if not the PRs we made along the way.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants