-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new bin/ops scripts #134
Comments
fish version of function tf_to_aws_env --description 'Set AWS credentials with a backend tfvars file' --argument file
if test -z $file
set file secrets.backend.tfvars
end
echo "Setting AWS credentials for with $file…"
set -gx AWS_ACCESS_KEY_ID (parse_tfsecrets access_key $file)
set -gx AWS_SECRET_ACCESS_KEY (parse_tfsecrets secret_key $file)
set -gx AWS_DEFAULT_REGION (parse_tfsecrets region $file)
set -gx BUCKET_NAME (parse_tfsecrets bucket $file)
end |
fish version of function tf_to_gh_env --description 'Set GitHub environment secrets from backend and cicd tfvars files' --argument env_name
if test -z $env_name
echo "env_name must be set"
return 1
end
if ! test -f secrets.backend.tfvars
echo "secrets.backend.tfvars must be in current working directory"
return 1
end
if ! test -f secrets.cicd.tfvars
echo "secrets.cicd.tfvars must be in current working directory"
return 1
end
echo "Setting GH credentials for $env_name"
if test "$env_name" = "production"
gh secret set RAILS_MASTER_KEY -e $env_name < ../config/credentials/production.key
else
gh secret set RAILS_MASTER_KEY -e $env_name < ../config/master.key
end
parse_tfsecrets access_key secrets.backend.tfvars | gh secret set TERRAFORM_STATE_ACCESS_KEY -e $env_name
parse_tfsecrets secret_key secrets.backend.tfvars | gh secret set TERRAFORM_STATE_SECRET_ACCESS_KEY -e $env_name
parse_tfsecrets bucket secrets.backend.tfvars | gh secret set TERRAFORM_STATE_BUCKET_NAME -e $env_name
parse_tfsecrets cf_user secrets.cicd.tfvars | gh secret set CF_USERNAME -e $env_name
parse_tfsecrets cf_password secrets.cicd.tfvars | gh secret set CF_PASSWORD -e $env_name
end |
2 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Story
As a devops engineer,
I would like to script some currently manual tasks,
So that I can stop making mistakes the first time I set up an environment
Solution
Tasks
Acceptance Criteria
The text was updated successfully, but these errors were encountered: