Skip to content

Commit

Permalink
update api version and fix small test tf error
Browse files Browse the repository at this point in the history
  • Loading branch information
katbyte committed Feb 27, 2019
2 parents 9c6167c + ea1cb3f commit 1ff6648
Show file tree
Hide file tree
Showing 106 changed files with 1,804 additions and 830 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

FEATURES:

* **New Data Source**: `azurerm_api_management_product` [GH-2953]
* **New Data Source:** `azurerm_availability_set` [GH-2850]
* **New Data Source:** `azurerm_network_watcher` [GH-2791]
* **New Resource**: `azurerm_api_management_product` [GH-2953]
* **New Resource:** `azurerm_eventgrid_domain` [GH-2884]
* **New Resource:** `azurerm_lb_outbound_rule` [GH-2912]
* **New Resource:** `azurerm_media_service_account` [GH-2711]
Expand All @@ -20,6 +22,7 @@ IMPROVEMENTS:

BUG FIXES:

* `azurerm_api_management` - switching to use API version `2018-01-01` rather than `2018-06-01-preview` [GH-2958]
* `azurerm_batch_pool` - updating `max_tasks_per_node` to be ForceNew [GH-2856]
* `azurerm_key_vault_access_policy` - no longer silenty fails on creation of the `key_vault_id` property is invalid/doesn't exist [GH-2922]
* `azurerm_policy_definition` - making the `metadata` field to computed [GH-2939]
Expand Down
2 changes: 1 addition & 1 deletion azurerm/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"time"

resourcesprofile "github.com/Azure/azure-sdk-for-go/profiles/2017-03-09/resources/mgmt/resources"
"github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2018-01-01/apimanagement"
appinsights "github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2015-05-01/insights"
"github.com/Azure/azure-sdk-for-go/services/automation/mgmt/2015-10-31/automation"
"github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2017-09-01/batch"
Expand All @@ -35,7 +36,6 @@ import (
"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-08-01/network"
"github.com/Azure/azure-sdk-for-go/services/notificationhubs/mgmt/2017-04-01/notificationhubs"
"github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql"
"github.com/Azure/azure-sdk-for-go/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement"
"github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2018-01-01-preview/authorization"
"github.com/Azure/azure-sdk-for-go/services/preview/devspaces/mgmt/2018-06-01-preview/devspaces"
"github.com/Azure/azure-sdk-for-go/services/preview/dns/mgmt/2018-03-01-preview/dns"
Expand Down
2 changes: 1 addition & 1 deletion azurerm/data_source_api_management.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"strings"

"github.com/Azure/azure-sdk-for-go/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement"
"github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2018-01-01/apimanagement"
"github.com/hashicorp/terraform/helper/schema"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
Expand Down
4 changes: 2 additions & 2 deletions azurerm/data_source_api_management_product.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package azurerm
import (
"fmt"

"github.com/Azure/azure-sdk-for-go/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement"
"github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2018-01-01/apimanagement"
"github.com/hashicorp/terraform/helper/schema"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
Expand Down Expand Up @@ -62,7 +62,7 @@ func dataSourceApiManagementProductRead(d *schema.ResourceData, meta interface{}
ctx := meta.(*ArmClient).StopContext

resourceGroup := d.Get("resource_group_name").(string)
serviceName := d.Get("service_name").(string)
serviceName := d.Get("api_management_name").(string)
productId := d.Get("product_id").(string)

resp, err := client.Get(ctx, resourceGroup, serviceName, productId)
Expand Down
2 changes: 1 addition & 1 deletion azurerm/resource_arm_api_management.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strconv"
"strings"

"github.com/Azure/azure-sdk-for-go/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement"
"github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2018-01-01/apimanagement"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/helper/validation"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
Expand Down
2 changes: 1 addition & 1 deletion azurerm/resource_arm_api_management_product.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"log"

"github.com/Azure/azure-sdk-for-go/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement"
"github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2018-01-01/apimanagement"
"github.com/hashicorp/terraform/helper/schema"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf"
Expand Down
6 changes: 3 additions & 3 deletions azurerm/resource_arm_api_management_product_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,9 +322,9 @@ resource "azurerm_api_management_product" "test" {
api_management_name = "${azurerm_api_management.test.name}"
resource_group_name = "${azurerm_resource_group.test.name}"
display_name = "Test Updated Product"
subscription_required = false
approval_required = false
published = false
subscription_required = true
approval_required = true
published = true
}
`, rInt, location, rInt)
}
Expand Down
2 changes: 1 addition & 1 deletion azurerm/resource_arm_api_management_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"log"

"github.com/Azure/azure-sdk-for-go/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement"
"github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2018-01-01/apimanagement"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/helper/validation"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
Expand Down
2 changes: 1 addition & 1 deletion azurerm/resource_arm_api_management_user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ resource "azurerm_api_management_user" "test" {
email = "azure-acctest%[email protected]"
state = "active"
confirmation = "signup"
notes = "Used for testing in dimension C-137."
note = "Used for testing in dimension C-137."
}
`, template, rInt, rInt)
}
Expand Down
2 changes: 1 addition & 1 deletion azurerm/resource_arm_cosmos_db_account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ func TestAccAzureRMCosmosDBAccount_mongoDB(t *testing.T) {
Check: resource.ComposeAggregateTestCheckFunc(
checkAccAzureRMCosmosDBAccount_basic(resourceName, testLocation(), string(documentdb.BoundedStaleness), 1),
resource.TestCheckResourceAttr(resourceName, "kind", "MongoDB"),
resource.TestCheckResourceAttr(resourceName, "connection_strings.#", "1"),
resource.TestCheckResourceAttr(resourceName, "connection_strings.#", "4"),
),
},
{
Expand Down
16 changes: 2 additions & 14 deletions examples/app-service/README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
# Azure App Service Sample
## Examples of using the App Service Resources

Sample to deploy an App Service within an App Service Plan.

## Creates

1. A Resource Group
2. An [App Service Plan](https://docs.microsoft.com/en-us/azure/app-service/azure-web-sites-web-hosting-plans-in-depth-overview)
3. An [App Service](https://azure.microsoft.com/en-gb/services/app-service/) configured for usage with .NET 4.x Application

## Usage

- Provide values to all variables (credentials and names).
- Create with `terraform apply`
- Destroy all with `terraform destroy --force`
This folder contains examples of using the App Service resources.
55 changes: 0 additions & 55 deletions examples/app-service/app.tf

This file was deleted.

25 changes: 25 additions & 0 deletions examples/app-service/docker-basic/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Example: a Linux App Service running a Docker container

This example provisions a Linux App Service which runs a single Docker container.

### Notes

* The Container is launched on the first HTTP Request, which can take a while.
* Continuous Deployment of a single Docker Container can be achieved using the App Setting `DOCKER_ENABLE_CI` to `true`.
* If you're not using App Service Slots and Deployments are handled outside of Terraform - [it's possible to ignore changes to specific fields in the configuration using `ignore_changes` within Terraform's `lifecycle` block](https://www.terraform.io/docs/configuration/resources.html#lifecycle), for example:

```hcl
resource "azurerm_app_service" "test" {
# ...
site_config = {
# ...
linux_fx_version = "DOCKER|appsvcsample/python-helloworld:0.1.2"
}
lifecycle {
ignore_changes = [
"site_config.0.linux_fx_version", # deployments are made outside of Terraform
]
}
}
```
42 changes: 42 additions & 0 deletions examples/app-service/docker-basic/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
provider "azurerm" {
# if you're using a Service Principal (shared account) then either set the environment variables, or fill these in:
# subscription_id = "..."
# client_id = "..."
# client_secret = "..."
# tenant_id = "..."
}

resource "azurerm_resource_group" "main" {
name = "${var.prefix}-resources"
location = "${var.location}"
}

resource "azurerm_app_service_plan" "main" {
name = "${var.prefix}-asp"
location = "${azurerm_resource_group.main.location}"
resource_group_name = "${azurerm_resource_group.main.name}"
kind = "Linux"
reserved = true

sku {
tier = "Standard"
size = "S1"
}
}

resource "azurerm_app_service" "main" {
name = "${var.prefix}-appservice"
location = "${azurerm_resource_group.main.location}"
resource_group_name = "${azurerm_resource_group.main.name}"
app_service_plan_id = "${azurerm_app_service_plan.main.id}"

site_config {
app_command_line = ""
linux_fx_version = "DOCKER|appsvcsample/python-helloworld:latest"
}

app_settings {
"WEBSITES_ENABLE_APP_SERVICE_STORAGE" = "false",
"DOCKER_REGISTRY_SERVER_URL" = "https://index.docker.io"
}
}
7 changes: 7 additions & 0 deletions examples/app-service/docker-basic/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
output "app_service_name" {
value = "${azurerm_app_service.main.name}"
}

output "app_service_default_hostname" {
value = "https://${azurerm_app_service.main.default_site_hostname}"
}
7 changes: 7 additions & 0 deletions examples/app-service/docker-basic/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
variable "prefix" {
description = "The prefix used for all resources in this example"
}

variable "location" {
description = "The Azure location where all resources in this example should be created"
}
24 changes: 24 additions & 0 deletions examples/app-service/docker-compose/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Example: a Linux App Service running multiple containers from a Docker Compose file.

This example provisions a Linux App Service which runs multiple Docker Containers from Docker Compose file.

### Notes

* The Container is launched on the first HTTP Request, which can take a while.
* If you're not using App Service Slots and Deployments are handled outside of Terraform - [it's possible to ignore changes to specific fields in the configuration using `ignore_changes` within Terraform's `lifecycle` block](https://www.terraform.io/docs/configuration/resources.html#lifecycle), for example:

```hcl
resource "azurerm_app_service" "test" {
# ...
site_config = {
# ...
linux_fx_version = "COMPOSE|${base64encode(file("compose.yml"))}"
}
lifecycle {
ignore_changes = [
"site_config.0.linux_fx_version", # deployments are made outside of Terraform
]
}
}
```
27 changes: 27 additions & 0 deletions examples/app-service/docker-compose/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
version: '3.3'

services:
db:
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: somewordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress

wordpress:
depends_on:
- db
image: wordpress:latest
ports:
- "8000:80"
restart: always
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
volumes:
db_data:
41 changes: 41 additions & 0 deletions examples/app-service/docker-compose/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
provider "azurerm" {
# if you're using a Service Principal (shared account) then either set the environment variables, or fill these in:
# subscription_id = "..."
# client_id = "..."
# client_secret = "..."
# tenant_id = "..."
}

resource "azurerm_resource_group" "main" {
name = "${var.prefix}-resources"
location = "${var.location}"
}

resource "azurerm_app_service_plan" "main" {
name = "${var.prefix}-asp"
location = "${azurerm_resource_group.main.location}"
resource_group_name = "${azurerm_resource_group.main.name}"
kind = "Linux"
reserved = true

sku {
tier = "Standard"
size = "S1"
}
}

resource "azurerm_app_service" "main" {
name = "${var.prefix}-appservice"
location = "${azurerm_resource_group.main.location}"
resource_group_name = "${azurerm_resource_group.main.name}"
app_service_plan_id = "${azurerm_app_service_plan.main.id}"

site_config {
app_command_line = ""
linux_fx_version = "COMPOSE|${base64encode(file("docker-compose.yml"))}"
}

app_settings {
"WEBSITES_ENABLE_APP_SERVICE_STORAGE" = "false"
}
}
7 changes: 7 additions & 0 deletions examples/app-service/docker-compose/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
output "app_service_name" {
value = "${azurerm_app_service.main.name}"
}

output "app_service_default_hostname" {
value = "https://${azurerm_app_service.main.default_site_hostname}"
}
7 changes: 7 additions & 0 deletions examples/app-service/docker-compose/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
variable "prefix" {
description = "The prefix used for all resources in this example"
}

variable "location" {
description = "The Azure location where all resources in this example should be created"
}
Loading

0 comments on commit 1ff6648

Please sign in to comment.