Skip to content

Commit

Permalink
feat: Add planner api connection
Browse files Browse the repository at this point in the history
  • Loading branch information
fdmsantos committed May 23, 2024
1 parent 7442869 commit c58469a
Show file tree
Hide file tree
Showing 10 changed files with 116 additions and 3 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@ Dynamic Terraform Module to Create Azure API Connections.

## Supported Connections

| Connection | Module api_type Parameter | Module api_type Parameter |
| Connection | Module api_type Parameter | Observations |
|-------------------|---------------------------|-------------------------------------|
| Azure Blob | azureblob | Supports All 4 Authentication Types |
| Sharepoint Online | sharepointonline | |
| Office 365 | office365 | |
| Planner | planner | |

## How to Use

Expand Down Expand Up @@ -76,6 +77,7 @@ module "sharepointonline" {
- [azureblob](https://github.com/fdmsantos/terraform-azurerm-api-connections/tree/main/examples/azureblob) - Creates an api connection to azure blob storage.
- [sharepointonline](https://github.com/fdmsantos/terraform-azurerm-api-connections/tree/main/examples/sharepointonline) - Creates an api connection to sharepoint.
- [office365](https://github.com/fdmsantos/terraform-azurerm-api-connections/tree/main/examples/office365) - Creates an api connection to Office 365.
- [planner](https://github.com/fdmsantos/terraform-azurerm-api-connections/tree/main/examples/planner) - Creates an api connection to Microsoft Planner.

<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements
Expand Down
11 changes: 11 additions & 0 deletions examples/planner/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
resource "azurerm_resource_group" "this" {
name = "RG-${title(var.name)}"
location = var.location
}

module "api_connection" {
source = "../../"
api_type = "planner"
resource_group_name = azurerm_resource_group.this.name
connection_display_name = "Demo Planner Connection"
}
19 changes: 19 additions & 0 deletions examples/planner/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
output "connection_id" {
description = "Api Connection Resource ID."
value = module.api_connection.connection_id
}

output "managed_api_id" {
description = "Managed API ID."
value = module.api_connection.managed_api_id
}

output "connection_name" {
description = "Api Connection Name."
value = module.api_connection.connection_name
}

output "logic_app_parameter" {
description = "Logic Apps Managed Identity Output to use in Logic App Parameters to configure this connection."
value = module.api_connection.logic_app_parameter
}
5 changes: 5 additions & 0 deletions examples/planner/providers.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
provider "azurerm" {
skip_provider_registration = true
subscription_id = var.subscription_id
features {}
}
15 changes: 15 additions & 0 deletions examples/planner/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
variable "name" {
description = "Specifies the name of resource group."
type = string
}

variable "location" {
description = "Specifies the Azure Region to create api connection. Changing this forces a new resource to be created."
type = string
default = "westeurope"
}

variable "subscription_id" {
description = "Specifies the subscription id should be used for this demo."
type = string
}
9 changes: 9 additions & 0 deletions examples/planner/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
terraform {
required_version = ">= 0.13.1"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">= 3.22"
}
}
}
1 change: 1 addition & 0 deletions locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ locals {
azureblob : templatefile("${path.module}/templates/azureblob.tftpl", local.azureblob_template_parameters[var.azureblob_authentication_type])
sharepointonline : templatefile("${path.module}/templates/sharepointonline.tftpl", {})
office365 : templatefile("${path.module}/templates/office365.tftpl", {})
planner : templatefile("${path.module}/templates/planner.tftpl", {})
}

logic_app_parameters = {
Expand Down
51 changes: 51 additions & 0 deletions templates/planner.tftpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"name": {
"type": "String"
},
"displayName": {
"type": "String"
},
"tags": {
"type": "Object",
"defaultValue": {},
"metadata": {
"description": "Tags to apply to the Azure Connection."
}
}
},
"resources": [
{
"type": "Microsoft.Web/connections",
"apiVersion": "2016-06-01",
"name": "[parameters('name')]",
"location": "[resourceGroup().location]",
"tags": "[parameters('tags')]",
"kind": "V1",
"properties": {
"displayName": "[parameters('displayName')]",
"api": {
"name": "planner",
"displayName": "Planner",
"description": "Microsoft Planner lets you easily bring together teams, tasks, documents, and conversations for better results.",
"iconUri": "[concat('https://connectoricons-prod.azureedge.net/releases/v1.0.1680/1.0.1680.3652/planner/icon.png')]",
"brandColor": "#107c41",
"id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/',resourceGroup().location,'/managedApis/planner')]",
"type": "Microsoft.Web/locations/managedApis"
}
}
}
],
"outputs": {
"connectionId": {
"type": "String",
"value": "[resourceId('Microsoft.Web/connections', parameters('name'))]"
},
"managedApiId": {
"type": "String",
"value": "[reference(resourceId('Microsoft.Web/connections', parameters('name')),'2016-06-01', 'full').properties.api.id]"
}
}
}
2 changes: 1 addition & 1 deletion templates/sharepointonline.tftpl
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,5 @@
"type": "String",
"value": "[reference(resourceId('Microsoft.Web/connections', parameters('name')),'2016-06-01', 'full').properties.api.id]"
}
}
}
}
2 changes: 1 addition & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ variable "api_type" {
type = string
validation {
error_message = "Please choose a supported Managed API!"
condition = contains(["azureblob", "sharepointonline", "office365"], var.api_type)
condition = contains(["azureblob", "sharepointonline", "office365", "planner"], var.api_type)
}
}

Expand Down

0 comments on commit c58469a

Please sign in to comment.