generated from ministryofjustice/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ec2-user and cloud-watch-agent-windows ssm params
- Loading branch information
1 parent
a8d8366
commit 711ff6e
Showing
20 changed files
with
108 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,33 @@ | ||
# Introduction | ||
|
||
Preset configuration that can be plugged into the baseline module. | ||
|
||
For example: | ||
- standard wildcard cert | ||
- resources required for using image builder | ||
- an example security group setup | ||
|
||
## ec2-user key pairs | ||
|
||
If using baseline to create EC2 instances, follow these steps to create an | ||
`ec2-user` admin user. | ||
|
||
Step 1: Run terraform with `enable_ec2_user_keypair` set to true | ||
|
||
This will create a placeholder SSM parameter `ec2-user_pem` for storing the | ||
private key. | ||
|
||
Step 2: Generate key pairs | ||
|
||
Use `ssh-keygen` to generate key pairs. See example scripts in nomis | ||
terraform under the `.ssh` directory. | ||
|
||
Step 3: Generate key pairs | ||
|
||
Upload the private key to the `ec2-user_pem` ssm parameter. | ||
Commit the public key to this repo under the relevant application | ||
directory, e.g. for nomis, under `.ssh/nomis-test/ec2-user.pub` | ||
|
||
Step 4: Re-run terrafrom | ||
|
||
This will create the keypair resource. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
locals { | ||
|
||
# add a cloud watch windows SSM param if the file is present | ||
cloud_watch_windows_filename = "./templates/cloud_watch_windows.json" | ||
|
||
ssm_parameters_filter = flatten([ | ||
var.options.enable_ec2_user_keypair ? ["ec2-user"] : [], | ||
var.options.enable_ec2_cloud_watch_agent && fileexists(local.cloud_watch_windows_filename) ? ["cloud-watch-config"] : [], | ||
]) | ||
|
||
ssm_parameters = { | ||
|
||
cloud-watch-config = { | ||
postfix = "-" | ||
parameters = { | ||
windows = { | ||
description = "cloud watch agent config for windows" | ||
file = local.cloud_watch_windows_filename | ||
type = "String" | ||
} | ||
} | ||
} | ||
|
||
ec2-user = { | ||
postfix = "_" | ||
parameters = { | ||
pem = { | ||
description = "Private key for ec2-user key pair" | ||
} | ||
} | ||
} | ||
|
||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters