Skip to content

Commit

Permalink
Update README & fix destroy (#3)
Browse files Browse the repository at this point in the history
* Update README & fix destroy

* Fix fasit
  • Loading branch information
baksetercx authored May 22, 2024
1 parent 6d4beed commit 8676bb5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/destroy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
TF_VAR_my_name: ${{ github.head_ref }}
TF_VAR_repository: ${{ github.repository }}
ARM_CLIENT_ID: ${{ vars.ARM_CLIENT_ID }}
ARM_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET }}
ARM_SUBSCRIPTION_ID: ${{ vars.ARM_SUBSCRIPTION_ID }}
ARM_TENANT_ID: ${{ vars.ARM_TENANT_ID }}
ARM_USE_OIDC: 'true'
defaults:
run:
working-directory: 'terraform'
Expand Down
27 changes: 21 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,24 +221,31 @@ resource "azurerm_container_app" "devops" {
Vi har lyst til å deploye med Terraform.
Legg til et siste steg som kjører en Terraform kommando for å endre infrastrukturen vår.

Push så til branchen din og se om det fungerer!

<details>
<summary>✨ Se fasit</summary>

```yaml
deploy:
name: 'Deploy using Terraform'
runs-on: ubuntu-latest
depends-on: [build]
needs: [build]
env:
TF_VAR_revision_suffix: ${{ github.sha }}
TF_VAR_my_name: ${{ env.MY_NAME }}
TF_VAR_my_name: ${{ github.head_ref }}
TF_VAR_repository: ${{ github.repository }}
ARM_CLIENT_ID: ${{ vars.ARM_CLIENT_ID }}
ARM_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET }}
ARM_SUBSCRIPTION_ID: ${{ vars.ARM_SUBSCRIPTION_ID }}
ARM_SUBSCRIPTION_ID: ${{ vars.ARM_SUBSCRIPTION_ID }}
ARM_TENANT_ID: ${{ vars.ARM_TENANT_ID }}
ARM_USE_OIDC: 'true'
permissions:
contents: read
id-token: write
environment: prod
defaults:
run:
working-directory: './terraform'
working-directory: 'terraform'
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -250,12 +257,20 @@ deploy:
run: terraform init
- name: Set Terraform workspace
run: teraform workspace new $MY_NAME || terraform workspace select $MY_NAME
run: terraform workspace new $TF_VAR_my_name || terraform workspace select $TF_VAR_my_name
- name: Run Terraform plan
run: terraform plan
- name: Run Terraform apply
run: terraform apply -auto-approve # legger til denne linjen
```

## 🔨 Oppgave 3.4

Se på `Outputs` under **Run Terraform apply** i loggen til GitHub Actions.
Her skal du finne en link til applikasjonen din.

</details>

# 🤓 Setup for spesielt interesserte (ikke en del av workshop'en)
Expand Down

0 comments on commit 8676bb5

Please sign in to comment.