Skip to content

Commit a529ebb

Browse files
committed
remove dependency on aws-vault
1 parent 59d5186 commit a529ebb

File tree

6 files changed

+20
-31
lines changed

6 files changed

+20
-31
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ Psst: [Need IaC for your Keycloak clients?](https://github.com/deadlysyn/keycloa
3939
## Prerequisites
4040

4141
- [aws v2 CLI](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html)
42-
- [aws-vault](https://github.com/99designs/aws-vault) installed and configured
4342
- Docker (container build/deploy)
4443
- UNIX-like OS (tested on Linux and MacOS)
4544

build/Makefile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ help:
55
@echo 'Build and Deploy Keycloak'
66
@echo ''
77
@echo 'Requirements:'
8-
@echo ' aws, aws-vault, docker, terraform'
8+
@echo ' aws, docker, terraform'
99
@echo ''
1010
@echo 'Usage:'
1111
@echo ' make <target> ENV=<environment_name>'
@@ -18,7 +18,6 @@ help:
1818
deps:
1919
@echo 'Checking dependencies...'
2020
@which aws
21-
@which aws-vault
2221
@which docker
2322
@which terraform
2423

@@ -28,4 +27,4 @@ build:
2827
$(BUILD_CMD)
2928

3029
deploy:
31-
$(DEPLOY_CMD)
30+
$(DEPLOY_CMD)

build/scripts/do.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,17 @@ set -eu
55
BASENAME=$(basename "${0}")
66
DIRNAME=$(dirname "${0}")
77
REGION="${AWS_REGION}"
8-
VAULT="aws-vault exec ${AWS_PROFILE} --"
98

109
build() {
1110
docker build -f "${DIRNAME}/../keycloak/Dockerfile" -t "${IMAGE}:latest" "${DIRNAME}/../keycloak"
1211
docker tag "${IMAGE}:latest" "${REPO}:latest"
1312
}
1413

1514
deploy() {
16-
${VAULT} aws ecr get-login-password --region "${REGION}" \
15+
aws ecr get-login-password --region "${REGION}" \
1716
| docker login --username AWS --password-stdin "${REPO_HOST}"
1817
docker push "${REPO}:latest"
19-
${VAULT} aws ecs update-service --region "${REGION}" \
18+
aws ecs update-service --region "${REGION}" \
2019
--force-new-deployment --cluster "${CLUSTER}" --service "${CLUSTER}-svc"
2120
}
2221

docs/bootstrapping.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,9 @@
99
## Bootstrapping
1010

1111
This document covers additional steps required when bootstrapping new environments.
12-
1312
Before continuing, be sure you have installed the [prerequisites](https://github.com/deadlysyn/terraform-keycloak-aws#prerequisites).
1413

15-
Automation wraps aws-vault for security. It needs [installed and configured](https://github.com/99designs/aws-vault#quick-start),
16-
so be sure you have a working AWS CLI profile and have imported credentials.
17-
Once CLIs are installed and you have an AWS profile ready, export the following
14+
Once AWS CLI v2 is installed and you have an AWS profile ready, export the following
1815
(or use something like [direnv](https://direnv.net) and a top-level `.envrc`
1916
to export automatically):
2017

@@ -23,8 +20,8 @@ export AWS_REGION="<aws_region>"
2320
export AWS_PROFILE="<aws_profile>"
2421
```
2522

26-
The region and profile variables are used by Terraform as well
27-
as the the build and deploy scripts.
23+
The region and profile variables are used by Terraform as well as the the build
24+
and deploy scripts.
2825

2926
### Preparation
3027

docs/troubleshooting.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ or access them using a CLI from your machine.
1111

1212
To follow along you'll need:
1313

14-
- [aws-vault configured](https://github.com/99designs/aws-vault#quick-start)
1514
- [cw installed](https://www.lucagrulla.com/cw)
1615
- `AWS_PROFILE` and `AWS_REGION` exported
1716

@@ -34,27 +33,27 @@ There is a log group per cluster, with naming convention of
3433

3534
```console
3635
# List log groups
37-
$ aws-vault exec $AWS_PROFILE -- cw --region $AWS_REGION ls groups
36+
$ cw --region $AWS_REGION ls groups
3837
/aws/ecs/cluster/n01113a46-keycloak-test
3938
/aws/ecs/containerinsights/n01113a46-keycloak-test/performance
4039
/aws/rds/cluster/n01113a46-keycloak-test-rds/error
4140
RDSOSMetrics
4241

4342
# List log streams
44-
$ aws-vault exec $AWS_PROFILE -- cw --region $AWS_REGION ls streams /aws/ecs/cluster/n01113a46-keycloak-test
43+
$ cw --region $AWS_REGION ls streams /aws/ecs/cluster/n01113a46-keycloak-test
4544
test/keycloak/814585f5-52da-4544-a91c-1356606611af
4645
test/keycloak/fe353380-f9dd-4ff4-a837-0c309f50f541
4746

4847
# Tail specific stream (isolate a specific container ID)
49-
$ aws-vault exec $AWS_PROFILE -- cw --region $AWS_REGION tail -f /aws/ecs/cluster/n01113a46-keycloak-test:test/keycloak/814585f5-52da-4544-a91c-1356606611af
48+
$ cw --region $AWS_REGION tail -f /aws/ecs/cluster/n01113a46-keycloak-test:test/keycloak/814585f5-52da-4544-a91c-1356606611af
5049
...
5150

5251
# Tail all streams in group (may be noisy, since it may include sidecars)
53-
$ aws-vault exec $AWS_PROFILE -- cw --region $AWS_REGION tail -f /aws/ecs/cluster/n01113a46-keycloak-test
52+
$ cw --region $AWS_REGION tail -f /aws/ecs/cluster/n01113a46-keycloak-test
5453
...
5554

5655
# Tail all logs with specified stream prefix (probably what you want)
57-
$ aws-vault exec $AWS_PROFILE -- cw --region $AWS_REGION tail -f /aws/ecs/cluster/n01113a46-keycloak-test:test/keycloak
56+
$ cw --region $AWS_REGION tail -f /aws/ecs/cluster/n01113a46-keycloak-test:test/keycloak
5857
auth-staging-keycloak 2020-10-15 19:26:35,596 INFO [org.keycloak.storage.ldap.LDAPStorageProviderFactory] (Timer-2) Sync of federation mapper 'group' finished. Status: UserFederationSyncResult [ 0 imported groups, 116 updated groups, 0 removed groups ]
5958
auth-staging-keycloak 2020-10-15 19:26:35,597 INFO [org.keycloak.storage.ldap.LDAPStorageProviderFactory] (Timer-2) Sync changed users from LDAP to local store: realm: test, federation provider: test.ldap.domain.tld, last sync time: Thu Oct 15 19:21:35 GMT 2020
6059
auth-staging-keycloak 2020-10-15 19:26:38,296 INFO [org.keycloak.storage.ldap.LDAPStorageProviderFactory] (Timer-2) Sync changed users finished: 0 imported users, 0 updated users

environments/template/Makefile

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
REGION := $(AWS_REGION)
2-
VAULT_CMD := aws-vault exec $(AWS_PROFILE) --duration=1h --
3-
TF_CMD := terraform
4-
CMD := $(VAULT_CMD) $(TF_CMD)
52

63
UNAME := $(shell uname)
74
ifeq ($(UNAME), Darwin)
@@ -16,7 +13,7 @@ help:
1613
@echo 'Manage Keycloak Infrastructure'
1714
@echo ''
1815
@echo 'Requirements:'
19-
@echo ' aws-vault, terraform'
16+
@echo ' terraform'
2017
@echo ''
2118
@echo 'Usage:'
2219
@echo ' make all create environment with remote state'
@@ -27,11 +24,10 @@ all: deps init applyandmigrate
2724

2825
deps:
2926
@echo 'Checking dependencies...'
30-
@which aws-vault
3127
@which terraform
3228

3329
init:
34-
$(CMD) init
30+
terraform init
3531

3632
applyprep:
3733
@sed $(SED_ARGS) \
@@ -40,11 +36,11 @@ applyprep:
4036
-e 's/\(force_destroy.*=\).*/\1 false/g' main.tf
4137

4238
applyandmigrate: applyprep
43-
$(CMD) apply -parallelism=20 -auto-approve
44-
$(CMD) init -force-copy
39+
terraform apply -parallelism=20 -auto-approve
40+
terraform init -force-copy
4541

4642
update: applyprep
47-
$(CMD) apply -parallelism=20
43+
terraform apply -parallelism=20
4844

4945
destroyprep:
5046
@sed $(SED_ARGS) \
@@ -53,9 +49,9 @@ destroyprep:
5349
-e 's/\(force_destroy.*=\).*/\1 true/g' main.tf
5450

5551
destroy: destroyprep
56-
$(CMD) apply -target module.terraform_state_backend -auto-approve
57-
$(CMD) init -force-copy
58-
$(CMD) destroy -parallelism=20
52+
terraform apply -target module.terraform_state_backend -auto-approve
53+
terraform init -force-copy
54+
terraform destroy -parallelism=20
5955

6056
clean: applyprep
6157
@rm -f backend.tf

0 commit comments

Comments
 (0)