https://github.com/gabegi/azure_apim_resources_terraform_module
Terraform module to create APIM resources
https://github.com/gabegi/azure_apim_resources_terraform_module
apim azure terraform-module
Last synced: 10 months ago
JSON representation
Terraform module to create APIM resources
- Host: GitHub
- URL: https://github.com/gabegi/azure_apim_resources_terraform_module
- Owner: Gabegi
- License: mit
- Created: 2025-01-28T08:17:05.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-19T17:06:31.000Z (about 1 year ago)
- Last Synced: 2025-05-07T01:07:40.599Z (about 1 year ago)
- Topics: apim, azure, terraform-module
- Language: HCL
- Homepage: https://medium.com/@codebob75/azure-apim-using-terraform-f439e93bb4f1
- Size: 22.5 KB
- Stars: 2
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Azure_APIM_Resources_Terraform_Module
This repository provides code examples that are explained in this blog [Azure APIM Using Terraform](https://medium.com/@codebob75/azure-apim-using-terraform-f439e93bb4f1)
To use this code, first create a file called values.tfvars file with your subscription key in the folder vars.
Then, navigate to the repo and run:
- terraform init
- terraform plan -var-file="vars/values.tfvars"
- terraform apply -auto-approve -var-file="vars/values.tfvars"
- terraform destroy -var-file="vars/values.tfvars"
To create an resources, simply add to your tfvars file the following
## API Module tfvars
```
version_sets = [
{
api_version_set_name = "my-version-set"
api_version_set_display_name = "My Version Set"
}
]
apis = [
{
api_name = "MyAPI"
api_revision = "1"
display_name = "MyAPI"
path = "my-api"
protocols = ["https"]
api_type = "http"
api_description = "Connect to my API backend"
api_version = "v1"
subscription_required = true
version_set_name = "my-version-set" # must match version set name
content_format = "openapi"
openapi_file = "./api-definitions/mydomainname/myapidefinitionfile.yaml"
}
]
api_policies = [
{
api_policy_name = "MyAPI-policy" # Must be unique (serves as index)
api_name = "MyAPI" # Must match api_name
xml_content = "./api-policies/mydomain/mypolicyname.xml"
}
]
api_operations = [
/// BC Batch
{
api_operation_name = "MyAPI-operation_1" # servers as index
api_name = "MyAPI" # must match API name
operation_id = "operation_1"
display_name = "Op 1"
method = "POST"
url_template = "/$items"
description = "An operation to create new items"
}
]
bc_operation_policies = {
MyAPI_opPolicy = {
api_name = "MyAPI" # must match api name, serves as index
operation_policy_name = "MyAPI-opPolicy"
policy_path = "./api-policies/mydomain/mypolicyname.xml"
operation_names = {
api_operation_operation_1_operation_id = "operation_1" # must match operation_id
}
}
}
```
## Product Module tfvars
```
products = {
display_name = "My Product"
product_id = "my-product"
subscription_required = true
published = true
}
```