Skip to content

Update app template to v7 or later

When you update an application from template version v6 to v7 or later, there are breaking changes.

How do I know what version I am using?

Go to your an application in your IaC-repository, and look for a file named .boilerplate/_template_app.json.

Example:

my-iac-repo/environments/dev/app-hello-world/.boilerplate/_template_app.json
{"name":"app","version":"6.0.0"}

Motivation

Avoid errors when deploying applications.

Before you begin

Make sure

Step 1: Update template version

Apply the template using boilerplate or ok pkg install.

In my-iac-repo/environments/dev/package.yml, ensure Ref field is set to v7.2.1 or later:

Packages:
  - OutputFolder: "app-hello-world"
    Template: "app"
    Ref: "v7.2.1" # or later
    VarFiles:
      - _config/common-config.yml
      - _config/app-hello-world.yml

Download the templates:

my-iac-repo/environments/dev
ok pkg install app-hello-world
my-iac-repo/environments/dev
boilerplate
--template-url git@github.com:oslokommune/golden-path-boilerplate.git//boilerplate/terraform/app?ref=v7.2.1 # or later
--output-folder app-hello-world
--non-interactive
--var-file _config/common-config.yml
--var-file _config/app-hello-world.yml

Step 2: Run scripts

my-iac-repo/environments/dev/
cd /my-app/bin
./set_role_secret_in_app_repo.sh
./set_role_secret_in_iac_repo.sh

What are these scripts?

The scripts set the secret AWS_ROLE_ARN in a GitHub repository.

They are part of the guides for CI/CD:

Step 3: Repeat for other environments

The above steps are for the dev environment. Repeat the steps for other environments such as production.

Verify

To verify that the changes are successful, you must verify that your CI/CD pipeline still works. You can do that by pushing a commit to the application repository.

Then verify that these workflows succeeds

  • pushing the application image to ECR (the workflow filename contains build_and_push_image.yml)
  • deploying the application with Terraform (the workflow filename contains: terraform_on_changed_dirs.yml)