Skip to content

Commit

Permalink
DOPS-101 Share packer ami between dops prod and sandbox
Browse files Browse the repository at this point in the history
  • Loading branch information
akagr committed Sep 14, 2022
1 parent 2d6f473 commit f5a4ca0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions bin/validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Set bash unofficial strict mode http://redsymbol.net/articles/unofficial-bash-strict-mode/
set -euo pipefail

# Set DEBUG to true for enhanced debugging: run prefixed with "DEBUG=true"
${DEBUG:-false} && set -vx
# Credit to https://stackoverflow.com/a/17805088
Expand Down Expand Up @@ -30,6 +30,7 @@ $DOCKER_PACKER validate app/packer/machines/web-server.json
if [[ "${SKIP_TERRAFORM:-false}" == "false" ]]; then
DOCKER_TERRAFORM=$(get_docker_terraform)
fmt=$($DOCKER_TERRAFORM fmt)
echo "Linting terraform files for formatting"
if [[ -n "$fmt" ]]; then
echo 'ERROR: these files are not formatted correctly. Run "terraform fmt"'
echo "$fmt"
Expand All @@ -42,7 +43,6 @@ if [[ "${SKIP_TERRAFORM:-false}" == "false" ]]; then
-var 'newrelic_license_key=ZZZZ' \
-var 'newrelic_api_key=ZZZZ' \
-var '[email protected]' \
echo "Linting terraform files for formatting"
fi

echo "Linting shell scripts"
Expand Down
3 changes: 2 additions & 1 deletion packer/machines/web-server.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"vpc_id": "{{user `aws_vpc_id`}}",
"ssh_username": "centos",
"ami_name": "devops-infra-demo-centos-7-{{timestamp}}",
"ami_description": "DevOps Infrastructure Demo CentOS 7 - CIS hardened"
"ami_description": "DevOps Infrastructure Demo CentOS 7 - CIS hardened",
"ami_users": ["587267277416"] // Share with devops sandbox account
}],
"provisioners": [
{
Expand Down
3 changes: 2 additions & 1 deletion terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ variable "google_project" {
default = "example-media"
}

# Use devops prod account as default. We bake and store AMIs using packer.
variable "aws_account_id_for_ami" {
description = "AWS Account ID where AMIs live, if not the default"
default = ""
default = "191447213457"
}

variable "ami_pattern" {
Expand Down

0 comments on commit f5a4ca0

Please sign in to comment.