Skip to content

Commit

Permalink
Add developer_portal_url, disable_gateway, enable_client_certificate,…
Browse files Browse the repository at this point in the history
… api_version_constraint, certificates, custom_properties, identity_user_assigned_identities, virtual_network_type, restore, scm_url, zones and diagnostic_settings columns to the table azure_api_management. Closes #292 (#336)
  • Loading branch information
c0d3r-arnab authored Sep 29, 2021
1 parent e00484d commit 4f770a0
Show file tree
Hide file tree
Showing 12 changed files with 212 additions and 112 deletions.
8 changes: 4 additions & 4 deletions azure-test/tests/azure_api_management/test-get-expected.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[
{
"id": "{{ output.resource_id.value }}",
"name": "{{resourceName}}",
"name": "{{ resourceName }}",
"publisher_email": "[email protected]",
"publisher_name": "TurbotHQ",
"region": "{{ output.location.value }}",
"region": "{{ output.region.value }}",
"sku_capacity": 1,
"sku_name": "Developer_1",
"sku_name": "Developer",
"type": "Microsoft.ApiManagement/service"
}
]
]
2 changes: 1 addition & 1 deletion azure-test/tests/azure_api_management/test-get-query.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
select name, id, region, type, publisher_email, publisher_name, sku_capacity, sku_name
from azure.azure_api_management
where name = '{{resourceName}}' and resource_group = '{{ output.resource_group_name.value }}'
where name = '{{ resourceName }}' and resource_group = '{{ resourceName }}';
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[
{
"name": "{{resourceName}}",
"name": "{{ resourceName }}",
"sku_name": "Developer"
}
]
]
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
select name, sku_name
from azure.azure_api_management
where name = '{{resourceName}}' and resource_group = '{{ output.resource_group_name.value }}'
where name = '{{ resourceName }}' and resource_group = '{{ resourceName }}';
4 changes: 2 additions & 2 deletions azure-test/tests/azure_api_management/test-list-expected.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[
{
"id": "{{ output.resource_id.value }}",
"name": "{{resourceName}}"
"name": "{{ resourceName }}"
}
]
]
2 changes: 1 addition & 1 deletion azure-test/tests/azure_api_management/test-list-query.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
select name, id
from azure.azure_api_management
where name = '{{resourceName}}'
where id = '{{ output.resource_id.value }}';
Original file line number Diff line number Diff line change
@@ -1 +1 @@
null
null
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
select name, id, region, type, publisher_email, publisher_name, sku_capacity
from azure.azure_api_management
where name = '{{resourceName}}' and resource_group = 'dummy-{{resourceName}}'
where name = '{{ resourceName }}' and resource_group = 'dummy-{{ resourceName }}';
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
[
{
"akas": [
"{{output.resource_aka.value }}",
"{{ output.resource_aka.value }}",
"{{ output.resource_aka_lower.value }}"
],
"name": "{{resourceName}}",
"tags": {
"name": "{{resourceName}}"
},
"title": "{{resourceName}}"
"name": "{{ resourceName }}",
"title": "{{ resourceName }}"
}
]
4 changes: 2 additions & 2 deletions azure-test/tests/azure_api_management/test-turbot-query.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
select name, akas, tags, title
select name, akas, title
from azure.azure_api_management
where name = '{{resourceName}}' and resource_group = '{{ output.resource_group_name.value }}'
where name = '{{ resourceName }}' and resource_group = '{{ resourceName }}';
78 changes: 29 additions & 49 deletions azure-test/tests/azure_api_management/variables.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

variable "resource_name" {
type = string
default = "turbot-test-20200125-create-update"
Expand All @@ -17,80 +16,61 @@ variable "azure_subscription" {
description = "Azure subscription used for the test."
}

variable "azure_resource_group" {
type = string
default = "integration_test_rg"
description = "Name of the resource group used throughout the test."
}

resource "azurerm_resource_group" "named_test_resource" {
name = var.resource_name
location = "West US"
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "=2.77.0"
}
}
}

provider "azurerm" {
# Cannot be passed as a variable
version = "=1.36.0"
features {}
environment = var.azure_environment
subscription_id = var.azure_subscription
}

data "azurerm_client_config" "current" {}

data "null_data_source" "resource" {
inputs = {
scope = "azure:///subscriptions/${data.azurerm_client_config.current.subscription_id}"
}
resource "azurerm_resource_group" "named_test_resource" {
name = var.resource_name
location = "West Europe"
}

resource "azurerm_api_management" "named_test_resource" {
name = var.resource_name
location = azurerm_resource_group.named_test_resource.location
resource_group_name = azurerm_resource_group.named_test_resource.name
publisher_name = "TurbotHQ"
publisher_email = "[email protected]"

sku_name = "Developer_1"
name = var.resource_name
location = azurerm_resource_group.named_test_resource.location
resource_group_name = azurerm_resource_group.named_test_resource.name
publisher_name = "TurbotHQ"
publisher_email = "[email protected]"

sku_name = "Developer_1"
}

policy {
xml_content = <<XML
<policies>
<inbound />
<backend />
<outbound />
<on-error />
</policies>
XML
}
tags = {
name = var.resource_name
}
output "region" {
depends_on = [azurerm_api_management.named_test_resource]
value = azurerm_resource_group.named_test_resource.location
}

output "resource_aka" {
value = "azure://${azurerm_api_management.named_test_resource.id}"
depends_on = [azurerm_api_management.named_test_resource]
value = "azure://${azurerm_api_management.named_test_resource.id}"
}

output "resource_aka_lower" {
value = "azure://${lower(azurerm_api_management.named_test_resource.id)}"
depends_on = [azurerm_api_management.named_test_resource]
value = "azure://${lower(azurerm_api_management.named_test_resource.id)}"
}

output "resource_name" {
value = var.resource_name
}

output "resource_id" {
value = azurerm_api_management.named_test_resource.id
}

output "location" {
value = azurerm_resource_group.named_test_resource.location
depends_on = [azurerm_api_management.named_test_resource]
value = azurerm_api_management.named_test_resource.id
}

output "subscription_id" {
value = var.azure_subscription
}

output "resource_group_name" {
value = var.azure_resource_group
}
Loading

0 comments on commit 4f770a0

Please sign in to comment.