added a few details in the README and variable stuff

This commit is contained in:
Amanda Crawley
2020-12-15 21:01:17 -04:00
parent acf98583fe
commit 5263ec36a8
6 changed files with 31 additions and 14 deletions

3
.gitignore vendored
View File

@@ -5,4 +5,5 @@ scim.env
.idea/
.terraform/
terraform.tfstate
terraform.tfstate.backup
terraform.tfstate.backup
terraform.tfvars

View File

@@ -2,5 +2,24 @@
This document describes deploying the 1Password SCIM bridge to your Amazon Web Service Elastic Container Service using Terraform.
Prerequisites
- DNS Zone
- scimsession file and bearer token
1. base64url encode your scimsession file and upload it to AWS Secret Manager. Take the arn and save it in terraform.tfvars with the name secret_arn.
2. Create or choose the zone you want to use and grab the zone id and save it as dns_zone_id in terraform.tfvars. Save the full domain name you want to use as domain_name in terraform.tfvars.
3. Create the AWS Log Group in CloudWatch where you would like the logs to go. Save the name in terraform.tfvars as aws_logs_group.
4. Create a region entry in terraform.tfvars for what region you're deploying in. You can omit this if you are using us-east-1.
Your terraform.tfvars file should look something like this:
domain_name = "scim-bridge.yourcompany.com"
dns_zone_id = "RANDOMLETTERS123"
secret_arn = "arn:aws:secretsmanager:<region>:<account-id>:secret:<secret-name>-BLAH"
aws_logs_group = "/ecs/scim-bridge"
Now run the following commands:
terraform apply -target=aws_acm_certificate.scim_bridge_cert
terraform apply

View File

@@ -23,13 +23,13 @@
{ "name": "OP_LETSENCRYPT_DOMAIN", "value": "" }
],
"secrets": [
{"name": "OP_SESSION", "valueFrom": "arn:aws:secretsmanager:us-east-1:729119775555:secret:ecs/scim-bridge/amanda-HF09CT"}
{"name": "OP_SESSION", "valueFrom": "${secret_arn}"}
],
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group" : "/ecs/scim-bridge",
"awslogs-region": "us-east-1",
"awslogs-group" : "${aws_logs_group}",
"awslogs-region": "${region}",
"awslogs-stream-prefix": "ecs-scim"
}
}
@@ -44,8 +44,8 @@
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group" : "/ecs/scim-bridge",
"awslogs-region": "us-east-1",
"awslogs-group" : "${aws_logs_group}",
"awslogs-region": "${region}",
"awslogs-stream-prefix": "ecs-redis"
}
},

View File

@@ -9,7 +9,11 @@ resource "aws_ecs_cluster" "scim-bridge" {
resource "aws_ecs_task_definition" "scim-bridge" {
family = "scim-bridge"
container_definitions = file("task-definitions/scim.json")
container_definitions = templatefile("task-definitions/scim.json",
{ secret_arn = var.secret_arn,
aws_logs_group = var.aws_logs_group,
region = var.region
})
requires_compatibilities = ["FARGATE"] # Stating that we are using ECS Fargate
network_mode = "awsvpc" # Using awsvpc as our network mode as this is required for Fargate
memory = 512 # Specifying the memory our container requires

View File

@@ -1,4 +1,3 @@
domain_name = "scim-bridge-amanda.play.agilebits.net"
region = "us-east-1"
dns_zone_id = "Z3V3UMKDNQGJ7A"
secret_arn = "arn:aws:secretsmanager:us-east-1:729119775555:secret:ecs/scim-bridge/amanda-HF09CT"

View File

@@ -4,11 +4,6 @@ variable "region" {
default = "us-east-1"
}
variable "prefix" {
type = string
description = ""
default = "scim-bridge"
}
variable "secret_arn" {
type = string
@@ -23,7 +18,6 @@ variable "domain_name" {
variable "dns_zone_id" {
type = string
description = ""
default = "Z3V3UMKDNQGJ7A"
}
variable "aws_logs_group" {