Skip to content

Commit

Permalink
Merge branch 'master' into cdn-endpoint-delivery-rules
Browse files Browse the repository at this point in the history
  • Loading branch information
r0bnet committed Mar 18, 2020
2 parents e989463 + 26fd51a commit 8bff413
Show file tree
Hide file tree
Showing 105 changed files with 11,951 additions and 2,415 deletions.
14 changes: 12 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,27 @@

FEATURES:

* **New Data Source:** `azurerm_app_configuration` [GH-6133]
* **New Data Source:** `azurerm_powerbi_embedded` [GH-5152]
* **New Resource:** `azurerm_cost_management_export_resource_group` [GH-6131]
* **New Resource:** `azurerm_powerbi_embedded` [GH-5152]
* **New Resource:** `azurerm_virtual_hub_connection` [GH-5951]

IMPROVEMENTS:

* Data Source: * `azurerm_logic_app_workflow` - expose computed field: `endpoint_configuration` [GH-5862]
* `azurerm_application_gateway` - support for key vault SSL certificate via the `key_value_secret_id` property [GH-4366]
* `azurerm_function_app` - support for configuring `daily_memory_time_quota` [GH-6100]
* `azurerm_logic_app_workflow` - expose computed field: `endpoint_configuration` [GH-5862]
* `azurerm_linux_virtual_machine_scale_set` - support for `scale_in_policy` and `terminate_notification` [GH-5391]
* `azurerm_sql_database` - support for the `extended_auditing_policy` property [GH-5049]
* `azurerm_windows_virtual_machine_scale_set` - support for `scale_in_policy` and `terminate_notification` [GH-5391]

BUG FIXES:

* Data Source: `iothub_dps_shared_access_policy` - building the `primary_connection_string` and `secondary_connection_string` from the Service endpoint rather than the Devices endpoint [GH-6108]
* `iothub_dps_shared_access_policy` - building the `primary_connection_string` and `secondary_connection_string` from the Service endpoint rather than the Devices endpoint [GH-6108]
* Data Source: `azurerm_iothub_dps_shared_access_policy` - building the `primary_connection_string` and `secondary_connection_string` from the Service endpoint rather than the Devices endpoint [GH-6108]
* `azurerm_function_app` - Add `WEBSITE_CONTENT` & `WEBSITE_CONTENTAZUREFILECONNECTIONSTRING` for premium plans [GH-5761]
* `azurerm_iothub_dps_shared_access_policy` - building the `primary_connection_string` and `secondary_connection_string` from the Service endpoint rather than the Devices endpoint [GH-6108]
* `azurerm_linux_virtual_machine` - updating the validation for `name` to allow periods [GH-5966]
* `azurerm_linux_virtual_machine_scale_set` - updating the validation for `name` to allow periods [GH-5966]
* `azurerm_storage_management_policy` - Fixed the use of single blob rule actions [GH-5803]
Expand Down
6 changes: 6 additions & 0 deletions azurerm/internal/clients/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
compute "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/compute/client"
containerServices "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/containers/client"
cosmosdb "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/cosmos/client"
costmanagement "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/costmanagement/client"
datamigration "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/databasemigration/client"
databricks "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/databricks/client"
datafactory "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/datafactory/client"
Expand Down Expand Up @@ -51,6 +52,7 @@ import (
policy "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/policy/client"
portal "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/portal/client"
postgres "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/postgres/client"
powerBI "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/powerbi/client"
privatedns "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/privatedns/client"
recoveryServices "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/recoveryservices/client"
redis "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/redis/client"
Expand Down Expand Up @@ -89,6 +91,7 @@ type Client struct {
Compute *compute.Client
Containers *containerServices.Client
Cosmos *cosmosdb.Client
CostManagement *costmanagement.Client
DatabaseMigration *datamigration.Client
DataBricks *databricks.Client
DataFactory *datafactory.Client
Expand Down Expand Up @@ -122,6 +125,7 @@ type Client struct {
Policy *policy.Client
Portal *portal.Client
Postgres *postgres.Client
PowerBI *powerBI.Client
PrivateDns *privatedns.Client
RecoveryServices *recoveryServices.Client
Redis *redis.Client
Expand Down Expand Up @@ -159,6 +163,7 @@ func (client *Client) Build(ctx context.Context, o *common.ClientOptions) error
client.Compute = compute.NewClient(o)
client.Containers = containerServices.NewClient(o)
client.Cosmos = cosmosdb.NewClient(o)
client.CostManagement = costmanagement.NewClient(o)
client.DatabaseMigration = datamigration.NewClient(o)
client.DataBricks = databricks.NewClient(o)
client.DataFactory = datafactory.NewClient(o)
Expand Down Expand Up @@ -192,6 +197,7 @@ func (client *Client) Build(ctx context.Context, o *common.ClientOptions) error
client.Policy = policy.NewClient(o)
client.Portal = portal.NewClient(o)
client.Postgres = postgres.NewClient(o)
client.PowerBI = powerBI.NewClient(o)
client.PrivateDns = privatedns.NewClient(o)
client.RecoveryServices = recoveryServices.NewClient(o)
client.Redis = redis.NewClient(o)
Expand Down
2 changes: 2 additions & 0 deletions azurerm/internal/provider/required_resource_providers.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ func RequiredResourceProviders() map[string]struct{} {
"Microsoft.ContainerInstance": {},
"Microsoft.ContainerRegistry": {},
"Microsoft.ContainerService": {},
"Microsoft.CostManagement": {},
"Microsoft.Databricks": {},
"Microsoft.DataLakeAnalytics": {},
"Microsoft.DataLakeStore": {},
Expand Down Expand Up @@ -55,6 +56,7 @@ func RequiredResourceProviders() map[string]struct{} {
"Microsoft.NotificationHubs": {},
"Microsoft.OperationalInsights": {},
"Microsoft.OperationsManagement": {},
"Microsoft.PowerBIDedicated": {},
"Microsoft.Relay": {},
"Microsoft.RecoveryServices": {},
"Microsoft.Resources": {},
Expand Down
4 changes: 4 additions & 0 deletions azurerm/internal/provider/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/compute"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/containers"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/cosmos"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/costmanagement"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/databasemigration"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/databricks"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/datafactory"
Expand Down Expand Up @@ -48,6 +49,7 @@ import (
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/policy"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/portal"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/postgres"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/powerbi"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/privatedns"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/recoveryservices"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/redis"
Expand Down Expand Up @@ -83,6 +85,7 @@ func SupportedServices() []common.ServiceRegistration {
compute.Registration{},
containers.Registration{},
cosmos.Registration{},
costmanagement.Registration{},
databricks.Registration{},
datafactory.Registration{},
datalake.Registration{},
Expand Down Expand Up @@ -116,6 +119,7 @@ func SupportedServices() []common.ServiceRegistration {
policy.Registration{},
portal.Registration{},
postgres.Registration{},
powerbi.Registration{},
privatedns.Registration{},
recoveryservices.Registration{},
redis.Registration{},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
package appconfiguration

import (
"fmt"
"time"

"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/clients"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/appconfiguration/validate"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/tags"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/timeouts"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
)

func dataSourceAppConfiguration() *schema.Resource {
return &schema.Resource{
Read: dataSourceAppConfigurationRead,

Timeouts: &schema.ResourceTimeout{
Read: schema.DefaultTimeout(5 * time.Minute),
},

Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
ValidateFunc: validate.AppConfigurationName,
},

"resource_group_name": azure.SchemaResourceGroupNameForDataSource(),

"location": azure.SchemaLocationForDataSource(),

"sku": {
Type: schema.TypeString,
Computed: true,
},

"endpoint": {
Type: schema.TypeString,
Computed: true,
},

"primary_read_key": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"id": {
Type: schema.TypeString,
Computed: true,
Sensitive: true,
},
"secret": {
Type: schema.TypeString,
Computed: true,
Sensitive: true,
},
"connection_string": {
Type: schema.TypeString,
Computed: true,
Sensitive: true,
},
},
},
},

"secondary_read_key": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"id": {
Type: schema.TypeString,
Computed: true,
Sensitive: true,
},
"secret": {
Type: schema.TypeString,
Computed: true,
Sensitive: true,
},
"connection_string": {
Type: schema.TypeString,
Computed: true,
Sensitive: true,
},
},
},
},

"primary_write_key": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"id": {
Type: schema.TypeString,
Computed: true,
Sensitive: true,
},
"secret": {
Type: schema.TypeString,
Computed: true,
Sensitive: true,
},
"connection_string": {
Type: schema.TypeString,
Computed: true,
Sensitive: true,
},
},
},
},

"secondary_write_key": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"id": {
Type: schema.TypeString,
Computed: true,
Sensitive: true,
},
"secret": {
Type: schema.TypeString,
Computed: true,
Sensitive: true,
},
"connection_string": {
Type: schema.TypeString,
Computed: true,
Sensitive: true,
},
},
},
},

"tags": tags.SchemaDataSource(),
},
}
}

func dataSourceAppConfigurationRead(d *schema.ResourceData, meta interface{}) error {
client := meta.(*clients.Client).AppConfiguration.AppConfigurationsClient
ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d)
defer cancel()

name := d.Get("name").(string)
resourceGroup := d.Get("resource_group_name").(string)

resp, err := client.Get(ctx, resourceGroup, name)
if err != nil {
if utils.ResponseWasNotFound(resp.Response) {
return fmt.Errorf("App Configuration %q was not found in Resource Group %q", name, resourceGroup)
}

return fmt.Errorf("Error retrieving App Configuration %q (Resource Group %q): %+v", name, resourceGroup, err)
}

resultPage, err := client.ListKeys(ctx, resourceGroup, name, "")
if err != nil {
return fmt.Errorf("Failed to receive access keys for App Configuration %q (Resource Group %q): %+v", name, resourceGroup, err)
}

d.SetId(*resp.ID)

if location := resp.Location; location != nil {
d.Set("location", azure.NormalizeLocation(*location))
}

skuName := ""
if resp.Sku != nil && resp.Sku.Name != nil {
skuName = *resp.Sku.Name
}
d.Set("sku", skuName)

if props := resp.ConfigurationStoreProperties; props != nil {
d.Set("endpoint", props.Endpoint)
}

accessKeys := flattenAppConfigurationAccessKeys(resultPage.Values())
d.Set("primary_read_key", accessKeys.primaryReadKey)
d.Set("primary_write_key", accessKeys.primaryWriteKey)
d.Set("secondary_read_key", accessKeys.secondaryReadKey)
d.Set("secondary_write_key", accessKeys.secondaryWriteKey)

return tags.FlattenAndSet(d, resp.Tags)
}
Loading

0 comments on commit 8bff413

Please sign in to comment.