Skip to content

Commit b93dc64

Browse files
committed
deploy test apim in developer sku for testing purposes
1 parent 19f9e32 commit b93dc64

File tree

5 files changed

+131
-0
lines changed

5 files changed

+131
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: altinn-apim-test-rg
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- .github/workflows/altinn-apim-test-rg-deploy.yml
9+
- actions/terraform/apply/**
10+
- actions/terraform/plan/**
11+
- infrastructure/adminservices-test/altinn-apim-test-rg/**
12+
pull_request:
13+
branches:
14+
- main
15+
paths:
16+
- .github/workflows/altinn-apim-test-rg-deploy.yml
17+
- actions/terraform/apply/**
18+
- actions/terraform/plan/**
19+
- infrastructure/adminservices-test/altinn-apim-test-rg/**
20+
workflow_dispatch:
21+
inputs:
22+
log_level:
23+
required: true
24+
description: Terraform Log Level
25+
default: INFO
26+
type: choice
27+
options:
28+
- TRACE
29+
- DEBUG
30+
- INFO
31+
- WARN
32+
- ERROR
33+
34+
env:
35+
ENVIRONMENT: test
36+
TF_STATE_NAME: altinn-apim-test-rg.tfstate
37+
TF_PROJECT: ./infrastructure/adminservices-test/altinn-apim-test-rg
38+
ARM_CLIENT_ID: ${{ vars.TF_AZURE_CLIENT_ID }}
39+
ARM_SUBSCRIPTION_ID: 1ce8e9af-c2d6-44e7-9c5e-099a308056fe
40+
41+
permissions:
42+
id-token: write
43+
contents: write
44+
pull-requests: write
45+
46+
jobs:
47+
plan:
48+
name: Plan
49+
environment: reader
50+
runs-on: ubuntu-latest
51+
steps:
52+
- name: Checkout Repository
53+
uses: actions/checkout@v4
54+
55+
- name: Terraform Plan
56+
uses: altinn/altinn-platform/actions/terraform/plan@main
57+
with:
58+
working_directory: ${{ env.TF_PROJECT }}
59+
oidc_type: environment
60+
oidc_value: ${{ env.ENVIRONMENT }}
61+
arm_client_id: ${{ env.ARM_CLIENT_ID }}
62+
arm_subscription_id: ${{ env.ARM_SUBSCRIPTION_ID }}
63+
tf_state_name: ${{ env.TF_STATE_NAME }}
64+
gh_token: ${{ secrets.GITHUB_TOKEN }}
65+
tf_version: latest
66+
67+
deploy:
68+
name: Deploy
69+
environment: test
70+
if: github.ref == 'refs/heads/main'
71+
needs: plan
72+
runs-on: ubuntu-latest
73+
steps:
74+
- name: Checkout Repository
75+
uses: actions/checkout@v4
76+
77+
- name: Terraform Apply
78+
uses: altinn/altinn-platform/actions/terraform/apply@main
79+
with:
80+
working_directory: ${{ env.TF_PROJECT }}
81+
oidc_type: environment
82+
oidc_value: ${{ env.ENVIRONMENT }}
83+
arm_client_id: ${{ env.ARM_CLIENT_ID }}
84+
arm_subscription_id: ${{ env.ARM_SUBSCRIPTION_ID }}
85+
tf_state_name: ${{ env.TF_STATE_NAME }}
86+
tf_version: latest
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
resource "azurerm_api_management" "admin_test_apim" {
2+
name = "${var.name_prefix}-apim"
3+
location = azurerm_resource_group.rg.location
4+
resource_group_name = azurerm_resource_group.rg.name
5+
publisher_name = "Team-Platform"
6+
publisher_email = "[email protected]"
7+
8+
sku_name = "Developer_1"
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
terraform {
2+
required_providers {
3+
azurerm = {
4+
source = "hashicorp/azurerm"
5+
version = "~> 4.0"
6+
}
7+
}
8+
backend "azurerm" {
9+
use_azuread_auth = true
10+
}
11+
}
12+
13+
provider "azurerm" {
14+
subscription_id = var.subscription_id
15+
features {}
16+
resource_providers_to_register = [
17+
"Microsoft.ApiManagement",
18+
]
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
resource "azurerm_resource_group" "rg" {
2+
name = "${var.name_prefix}-rg"
3+
location = var.location
4+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
variable "subscription_id" {
2+
type = string
3+
}
4+
5+
variable "location" {
6+
type = string
7+
default = "norwayeast"
8+
}
9+
10+
variable "name_prefix" {
11+
type = string
12+
default = "altinn-apim-test"
13+
}

0 commit comments

Comments
 (0)