Skip to content
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

feat: deploy test apim in developer sku for testing purposes #1397

Merged
merged 3 commits into from
Mar 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 87 additions & 0 deletions .github/workflows/altinn-apim-test-rg-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: altinn-apim-test-rg

on:
push:
branches:
- main
paths:
- .github/workflows/altinn-apim-test-rg-deploy.yml
- actions/terraform/apply/**
- actions/terraform/plan/**
- infrastructure/adminservices-test/altinn-apim-test-rg/**
pull_request:
branches:
- main
paths:
- .github/workflows/altinn-apim-test-rg-deploy.yml
- actions/terraform/apply/**
- actions/terraform/plan/**
- infrastructure/adminservices-test/altinn-apim-test-rg/**
workflow_dispatch:
inputs:
log_level:
required: true
description: Terraform Log Level
default: INFO
type: choice
options:
- TRACE
- DEBUG
- INFO
- WARN
- ERROR

env:
ENVIRONMENT: test
TF_STATE_NAME: altinn-apim-test-rg.tfstate
TF_PROJECT: ./infrastructure/adminservices-test/altinn-apim-test-rg
TF_VERSION: "1.10.5"
ARM_CLIENT_ID: ${{ vars.TF_AZURE_CLIENT_ID }}
ARM_SUBSCRIPTION_ID: 1ce8e9af-c2d6-44e7-9c5e-099a308056fe

permissions:
id-token: write
contents: write
pull-requests: write

jobs:
plan:
name: Plan
environment: reader
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Terraform Plan
uses: altinn/altinn-platform/actions/terraform/plan@main
with:
working_directory: ${{ env.TF_PROJECT }}
oidc_type: environment
oidc_value: ${{ env.ENVIRONMENT }}
arm_client_id: ${{ env.ARM_CLIENT_ID }}
arm_subscription_id: ${{ env.ARM_SUBSCRIPTION_ID }}
tf_state_name: ${{ env.TF_STATE_NAME }}
gh_token: ${{ secrets.GITHUB_TOKEN }}
tf_version: ${{ env.TF_VERSION }}

deploy:
name: Deploy
environment: test
if: github.ref == 'refs/heads/main'
needs: plan
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Terraform Apply
uses: altinn/altinn-platform/actions/terraform/apply@main
with:
working_directory: ${{ env.TF_PROJECT }}
oidc_type: environment
oidc_value: ${{ env.ENVIRONMENT }}
arm_client_id: ${{ env.ARM_CLIENT_ID }}
arm_subscription_id: ${{ env.ARM_SUBSCRIPTION_ID }}
tf_state_name: ${{ env.TF_STATE_NAME }}
tf_version: ${{ env.TF_VERSION }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
resource "azurerm_api_management" "admin_test_apim" {
name = "${var.name_prefix}-apim"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
publisher_name = "Team-Platform"
publisher_email = "[email protected]"

sku_name = "Developer_1"
}
19 changes: 19 additions & 0 deletions infrastructure/adminservices-test/altinn-apim-test-rg/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 4.0"
}
}
backend "azurerm" {
use_azuread_auth = true
}
}

provider "azurerm" {
subscription_id = var.subscription_id
features {}
resource_providers_to_register = [
"Microsoft.ApiManagement",
]
}
4 changes: 4 additions & 0 deletions infrastructure/adminservices-test/altinn-apim-test-rg/rg.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
resource "azurerm_resource_group" "rg" {
name = "${var.name_prefix}-rg"
location = var.location
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
subscription_id = "1ce8e9af-c2d6-44e7-9c5e-099a308056fe"
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
variable "subscription_id" {
type = string
}

variable "location" {
type = string
default = "norwayeast"
}

variable "name_prefix" {
type = string
default = "altinn-apim-test"
}
Loading