Skip to content

Commit 2d817df

Browse files
authored
Merge pull request #29 from commitdev/add-required-account-id-to-bootstrap
Add required aws account id to bootstrap so we don't create this stuf…
2 parents 51c9d47 + c2c8d45 commit 2d817df

File tree

2 files changed

+24
-21
lines changed

2 files changed

+24
-21
lines changed

terraform/bootstrap/remote-state/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
provider "aws" {
22
region = "<% index .Params `region` %>"
3+
allowed_account_ids = [ "<% index .Params `accountId` %>" ]
34
}
45

56
resource "aws_s3_bucket" "terraform_remote_state" {
Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,32 @@
1-
provider "aws" {
2-
region = "<% index .Params `region` %>"
3-
}
1+
provider "aws" {
2+
region = "<% index .Params `region` %>"
3+
allowed_account_ids = [ "<% index .Params `accountId` %>" ]
4+
}
5+
46

5-
terraform {
6-
required_version = ">= 0.12"
7-
}
7+
terraform {
8+
required_version = ">= 0.12"
9+
}
810

911
locals {
1012
project = "<% .Name %>"
1113
}
1214

13-
# Create the CI User
14-
resource "aws_iam_user" "ci_user" {
15-
name = "${local.project}-ci-user"
16-
}
15+
# Create the CI User
16+
resource "aws_iam_user" "ci_user" {
17+
name = "${local.project}-ci-user"
18+
}
1719

18-
# Create a keypair to be used by CI systems
19-
resource "aws_iam_access_key" "ci_user" {
20-
user = aws_iam_user.ci_user.name
21-
}
20+
# Create a keypair to be used by CI systems
21+
resource "aws_iam_access_key" "ci_user" {
22+
user = aws_iam_user.ci_user.name
23+
}
2224

23-
# Add the keys to AWS secrets manager
24-
module "ci_user_keys" {
25-
source = "../../modules/secret"
25+
# Add the keys to AWS secrets manager
26+
module "ci_user_keys" {
27+
source = "../../modules/secret"
2628

27-
name_prefix = "ci-user-aws-keys"
28-
type = "map"
29-
values = map("access_key_id", aws_iam_access_key.ci_user.id, "secret_key", aws_iam_access_key.ci_user.secret)
30-
}
29+
name_prefix = "ci-user-aws-keys"
30+
type = "map"
31+
values = map("access_key_id", aws_iam_access_key.ci_user.id, "secret_key", aws_iam_access_key.ci_user.secret)
32+
}

0 commit comments

Comments
 (0)