|
1 | | -provider "aws" { |
2 | | - region = "<% index .Params `region` %>" |
3 | | -} |
4 | | - |
5 | | -terraform { |
6 | | - required_version = ">= 0.12" |
7 | | -} |
8 | | - |
9 | | -# Create the CI User |
10 | | -resource "aws_iam_user" "ci_user" { |
11 | | - name = "ci-user" |
12 | | -} |
13 | | - |
14 | | -# Create a keypair to be used by CI systems |
15 | | -resource "aws_iam_access_key" "ci_user" { |
16 | | - user = aws_iam_user.ci_user.name |
17 | | -} |
18 | | - |
19 | | -# Add the keys to AWS secrets manager |
20 | | -module "ci_user_keys" { |
21 | | - source = "../../modules/secret" |
22 | | - |
23 | | - name = "ci-user-aws-keys" |
24 | | - type = "map" |
25 | | - values = map("access_key_id", aws_iam_access_key.ci_user.id, "secret_key", aws_iam_access_key.ci_user.secret) |
26 | | -} |
27 | | - |
28 | | - |
29 | | - # Create db credentials |
30 | | - # Unfortunately tf doesn't yet allow you to use for_each with calls to modules |
31 | | - locals { |
32 | | - project = "<% .Name %>" |
33 | | - } |
34 | | - |
35 | | -module "db_password-staging" { |
36 | | - source = "../../modules/secret" |
37 | | - |
38 | | - name = "${local.project}-staging-rds-master-password" |
39 | | - type = "random" |
40 | | -} |
41 | | - |
42 | | -module "db_password-production" { |
43 | | - source = "../../modules/secret" |
44 | | - |
45 | | - name = "${local.project}-production-rds-master-password" |
46 | | - type = "random" |
47 | | - random_length = 32 |
48 | | -} |
| 1 | +provider "aws" { |
| 2 | + region = "<% index .Params `region` %>" |
| 3 | +} |
| 4 | + |
| 5 | +terraform { |
| 6 | + required_version = ">= 0.12" |
| 7 | +} |
| 8 | + |
| 9 | +# Create the CI User |
| 10 | +resource "aws_iam_user" "ci_user" { |
| 11 | + name = "${var.project}-ci-user" |
| 12 | +} |
| 13 | + |
| 14 | +# Create a keypair to be used by CI systems |
| 15 | +resource "aws_iam_access_key" "ci_user" { |
| 16 | + user = aws_iam_user.ci_user.name |
| 17 | +} |
| 18 | + |
| 19 | +# Add the keys to AWS secrets manager |
| 20 | +module "ci_user_keys" { |
| 21 | + source = "../../modules/secret" |
| 22 | + |
| 23 | + name_prefix = "ci-user-aws-keys" |
| 24 | + type = "map" |
| 25 | + values = map("access_key_id", aws_iam_access_key.ci_user.id, "secret_key", aws_iam_access_key.ci_user.secret) |
| 26 | +} |
0 commit comments