Skip to content

Commit 24ee63b

Browse files
authored
feat: deploy test apim in developer sku for testing purposes (#1397)
* deploy test apim in developer sku for testing purposes * test downgrading tf version * add tfvars --------- Co-authored-by: tjololo <[email protected]>
1 parent f68f5ae commit 24ee63b

File tree

6 files changed

+133
-0
lines changed

6 files changed

+133
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
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+
TF_VERSION: "1.10.5"
39+
ARM_CLIENT_ID: ${{ vars.TF_AZURE_CLIENT_ID }}
40+
ARM_SUBSCRIPTION_ID: 1ce8e9af-c2d6-44e7-9c5e-099a308056fe
41+
42+
permissions:
43+
id-token: write
44+
contents: write
45+
pull-requests: write
46+
47+
jobs:
48+
plan:
49+
name: Plan
50+
environment: reader
51+
runs-on: ubuntu-latest
52+
steps:
53+
- name: Checkout Repository
54+
uses: actions/checkout@v4
55+
56+
- name: Terraform Plan
57+
uses: altinn/altinn-platform/actions/terraform/plan@main
58+
with:
59+
working_directory: ${{ env.TF_PROJECT }}
60+
oidc_type: environment
61+
oidc_value: ${{ env.ENVIRONMENT }}
62+
arm_client_id: ${{ env.ARM_CLIENT_ID }}
63+
arm_subscription_id: ${{ env.ARM_SUBSCRIPTION_ID }}
64+
tf_state_name: ${{ env.TF_STATE_NAME }}
65+
gh_token: ${{ secrets.GITHUB_TOKEN }}
66+
tf_version: ${{ env.TF_VERSION }}
67+
68+
deploy:
69+
name: Deploy
70+
environment: test
71+
if: github.ref == 'refs/heads/main'
72+
needs: plan
73+
runs-on: ubuntu-latest
74+
steps:
75+
- name: Checkout Repository
76+
uses: actions/checkout@v4
77+
78+
- name: Terraform Apply
79+
uses: altinn/altinn-platform/actions/terraform/apply@main
80+
with:
81+
working_directory: ${{ env.TF_PROJECT }}
82+
oidc_type: environment
83+
oidc_value: ${{ env.ENVIRONMENT }}
84+
arm_client_id: ${{ env.ARM_CLIENT_ID }}
85+
arm_subscription_id: ${{ env.ARM_SUBSCRIPTION_ID }}
86+
tf_state_name: ${{ env.TF_STATE_NAME }}
87+
tf_version: ${{ env.TF_VERSION }}
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 @@
1+
subscription_id = "1ce8e9af-c2d6-44e7-9c5e-099a308056fe"
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)