Skip to content

Commit c0cb3e2

Browse files
committed
Merge branch 'develop' of github.com:cisagov/skeleton-ansible-role-with-test-user into lineage/skeleton
2 parents c5a131b + 68043bf commit c0cb3e2

File tree

7 files changed

+85
-11
lines changed

7 files changed

+85
-11
lines changed

.github/lineage.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
2-
version: "1"
3-
42
lineage:
53
skeleton:
6-
remote-url: https://github.com/cisagov/skeleton-ansible-role.git
4+
remote-url: https://github.com/cisagov/skeleton-ansible-role-with-test-user.git
5+
version: '1'

.gitignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
.mypy_cache
2-
__pycache__
32
.python-version
4-
terraform/.terraform
3+
__pycache__
4+
.terraform

README.md

+46
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,52 @@
77
An Ansible role for installing
88
[cisagov/ncats-webd](https://github.com/cisagov/ncats-webd).
99

10+
## Pre-requisites (Ignore Until the COOL Migration) ##
11+
12+
In order to execute the Molecule tests for this Ansible role in GitHub
13+
Actions, a build user must exist in AWS. The accompanying Terraform
14+
code will create the user with the appropriate name and
15+
permissions. This only needs to be run once per project, per AWS
16+
account. This user can also be used to run the Molecule tests on your
17+
local machine.
18+
19+
Before the build user can be created, the following profile must exist in
20+
your AWS credentials file:
21+
22+
* `cool-terraform-backend`
23+
24+
The easiest way to set up that profile is to use our
25+
[`aws-profile-sync`](https://github.com/cisagov/aws-profile-sync)
26+
utility. Follow the usage instructions in that repository before
27+
continuing with the next steps. Note that you will need to know where
28+
your team stores their remote profile data in order to use
29+
[`aws-profile-sync`](https://github.com/cisagov/aws-profile-sync).
30+
31+
To create the build user, follow these instructions:
32+
33+
```console
34+
cd terraform
35+
terraform init --upgrade=true
36+
terraform apply
37+
```
38+
39+
Once the user is created you will need to update the [repository's
40+
secrets](https://help.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets)
41+
with the new encrypted environment variables. This should be done
42+
using the
43+
[`terraform-to-secrets`](https://github.com/cisagov/development-guide/tree/develop/project_setup#terraform-iam-credentials-to-github-secrets-)
44+
tool available in the [development
45+
guide](https://github.com/cisagov/development-guide). Instructions for
46+
how to use this tool can be found in the ["Terraform IAM Credentials
47+
to GitHub Secrets"
48+
section](https://github.com/cisagov/development-guide/tree/develop/project_setup#terraform-iam-credentials-to-github-secrets-).
49+
of the Project Setup README.
50+
51+
If you have appropriate permissions for the repository you can view
52+
existing secrets on the [appropriate
53+
page](https://github.com/cisagov/ansible-role-ncats-webd/settings/secrets) in
54+
the repository's settings.
55+
1056
## Requirements ##
1157

1258
None.

terraform/backend.tf

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
terraform {
22
backend "s3" {
3-
encrypt = true
43
bucket = "ncats-terraform-state-storage"
54
dynamodb_table = "terraform-state-lock"
6-
region = "us-east-1"
5+
encrypt = true
76
key = "ansible-role-ncats-webd/terraform.tfstate"
7+
region = "us-east-1"
88
}
99
}

terraform/outputs.tf

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
output "access_key" {
2+
value = module.user.access_key
3+
description = "The IAM access key associated with the CI IAM user created by this module."
4+
sensitive = true
5+
}
6+
7+
output "production_role" {
8+
value = module.user.production_role
9+
description = "The IAM role that the CI user can assume to read SSM parameters in the production account."
10+
}
11+
12+
output "staging_role" {
13+
value = module.user.staging_role
14+
description = "The IAM role that the CI user can assume to read SSM parameters in the staging account."
15+
}
16+
17+
output "user" {
18+
value = module.user.user
19+
description = "The CI IAM user created by this module."
20+
}

terraform/iam_user.tf terraform/user.tf

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
module "iam_user" {
1+
# Create the test user
2+
module "user" {
23
source = "github.com/cisagov/molecule-iam-user-tf-module"
34

45
providers = {
@@ -11,5 +12,6 @@ module "iam_user" {
1112

1213
entity = "ansible-role-ncats-webd"
1314
ssm_parameters = ["/cyhy/core/geoip/license_key"]
14-
tags = var.tags
15+
16+
tags = var.tags
1517
}

terraform/versions.tf

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
21
terraform {
3-
required_version = ">= 0.12"
2+
# We want to hold off on 0.13 until we have tested it.
3+
required_version = "~> 0.12.0"
4+
5+
# If you use any other providers you should also pin them to the
6+
# major version currently being used. This practice will help us
7+
# avoid unwelcome surprises.
8+
required_providers {
9+
aws = "~> 2.0"
10+
}
411
}

0 commit comments

Comments
 (0)