Skip to content

Commit

Permalink
Merge with master
Browse files Browse the repository at this point in the history
  • Loading branch information
mbfrahry committed Mar 4, 2019
2 parents a545036 + a51fddf commit 14d68f3
Show file tree
Hide file tree
Showing 24 changed files with 1,735 additions and 68 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ FEATURES:
* **New Resource:** `azurerm_api_management_group` [GH-2809]
* **New Resource:** `azurerm_api_management_group_user` [GH-2972]
* **New Resource:** `azurerm_api_management_product` [GH-2953]
* **New Resource:** `azurerm_api_management_product_group` [GH-2984]
* **New Resource:** `azurerm_api_management_user` [GH-2954]
* **New Resource:** `azurerm_eventgrid_domain` [GH-2884]
* **New Resource:** `azurerm_eventgrid_event_subscription` [GH-2967]
* **New Resource:** `azurerm_lb_outbound_rule` [GH-2912]
* **New Resource:** `azurerm_media_service_account` [GH-2711]
* **New Resource:** `azurerm_network_watcher` [GH-2791]
Expand All @@ -24,6 +26,7 @@ IMPROVEMENTS:
* `azurerm_application_gateway` - support for setting `path` within the `backend_http_settings` block [GH-2879]
* `azurerm_application_gateway` - support for setting `connection_draining` to the `backend_http_settings` [GH-2778]
* `azurerm_iothub` - support for the `fallback_route` property [GH-2764]
* `azurerm_key_vault` - support for 1024 `access_policy` blocks [GH-2866]
* `azurerm_redis_cache` - support for configuring the `maxfragmentationmemory_reserved` in the `redis_configuration` block [GH-2887]
* `azurerm_service_fabric_cluster` - support for setting `capacities` and `placement_properties` [GH-2936]
* `azurerm_storage_account` - exposing primary/secondary `_host` attributes [GH-2792]
Expand Down
32 changes: 21 additions & 11 deletions azurerm/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,12 @@ type ArmClient struct {
kubernetesClustersClient containerservice.ManagedClustersClient
containerGroupsClient containerinstance.ContainerGroupsClient

eventGridDomainsClient eventgrid.DomainsClient
eventGridTopicsClient eventgrid.TopicsClient
eventHubClient eventhub.EventHubsClient
eventHubConsumerGroupClient eventhub.ConsumerGroupsClient
eventHubNamespacesClient eventhub.NamespacesClient
eventGridDomainsClient eventgrid.DomainsClient
eventGridEventSubscriptionsClient eventgrid.EventSubscriptionsClient
eventGridTopicsClient eventgrid.TopicsClient
eventHubClient eventhub.EventHubsClient
eventHubConsumerGroupClient eventhub.ConsumerGroupsClient
eventHubNamespacesClient eventhub.NamespacesClient

solutionsClient operationsmanagement.SolutionsClient

Expand All @@ -126,12 +127,13 @@ type ArmClient struct {
redisPatchSchedulesClient redis.PatchSchedulesClient

// API Management
apiManagementGroupClient apimanagement.GroupClient
apiManagementGroupUsersClient apimanagement.GroupUserClient
apiManagementProductsClient apimanagement.ProductClient
apiManagementPropertyClient apimanagement.PropertyClient
apiManagementServiceClient apimanagement.ServiceClient
apiManagementUsersClient apimanagement.UserClient
apiManagementGroupClient apimanagement.GroupClient
apiManagementGroupUsersClient apimanagement.GroupUserClient
apiManagementProductsClient apimanagement.ProductClient
apiManagementProductGroupsClient apimanagement.ProductGroupClient
apiManagementPropertyClient apimanagement.PropertyClient
apiManagementServiceClient apimanagement.ServiceClient
apiManagementUsersClient apimanagement.UserClient

// Application Insights
appInsightsClient appinsights.ComponentsClient
Expand Down Expand Up @@ -508,6 +510,10 @@ func (c *ArmClient) registerApiManagementServiceClients(endpoint, subscriptionId
c.configureClient(&productsClient.Client, auth)
c.apiManagementProductsClient = productsClient

productGroupsClient := apimanagement.NewProductGroupClientWithBaseURI(endpoint, subscriptionId)
c.configureClient(&productGroupsClient.Client, auth)
c.apiManagementProductGroupsClient = productGroupsClient

propertiesClient := apimanagement.NewPropertyClientWithBaseURI(endpoint, subscriptionId)
c.configureClient(&propertiesClient.Client, auth)
c.apiManagementPropertyClient = propertiesClient
Expand Down Expand Up @@ -872,6 +878,10 @@ func (c *ArmClient) registerEventGridClients(endpoint, subscriptionId string, au
egdc := eventgrid.NewDomainsClientWithBaseURI(endpoint, subscriptionId)
c.configureClient(&egdc.Client, auth)
c.eventGridDomainsClient = egdc

egesc := eventgrid.NewEventSubscriptionsClientWithBaseURI(endpoint, subscriptionId)
c.configureClient(&egesc.Client, auth)
c.eventGridEventSubscriptionsClient = egesc
}

func (c *ArmClient) registerEventHubClients(endpoint, subscriptionId string, auth autorest.Authorizer) {
Expand Down
8 changes: 4 additions & 4 deletions azurerm/data_source_builtin_role_definition_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func TestAccDataSourceAzureRMBuiltInRoleDefinition_contributor(t *testing.T) {
{
Config: testAccDataSourceBuiltInRoleDefinition("Contributor"),
Check: resource.ComposeTestCheckFunc(
testAzureRMClientConfigAttr(dataSourceName, "id", "/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c"),
resource.TestCheckResourceAttr(dataSourceName, "id", "/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c"),
resource.TestCheckResourceAttrSet(dataSourceName, "description"),
resource.TestCheckResourceAttrSet(dataSourceName, "type"),
resource.TestCheckResourceAttr(dataSourceName, "permissions.#", "1"),
Expand All @@ -43,7 +43,7 @@ func TestAccDataSourceAzureRMBuiltInRoleDefinition_owner(t *testing.T) {
{
Config: testAccDataSourceBuiltInRoleDefinition("Owner"),
Check: resource.ComposeTestCheckFunc(
testAzureRMClientConfigAttr(dataSourceName, "id", "/providers/Microsoft.Authorization/roleDefinitions/8e3af657-a8ff-443c-a75c-2fe8c4bcb635"),
resource.TestCheckResourceAttr(dataSourceName, "id", "/providers/Microsoft.Authorization/roleDefinitions/8e3af657-a8ff-443c-a75c-2fe8c4bcb635"),
resource.TestCheckResourceAttrSet(dataSourceName, "description"),
resource.TestCheckResourceAttrSet(dataSourceName, "type"),
resource.TestCheckResourceAttr(dataSourceName, "permissions.#", "1"),
Expand All @@ -65,7 +65,7 @@ func TestAccDataSourceAzureRMBuiltInRoleDefinition_reader(t *testing.T) {
{
Config: testAccDataSourceBuiltInRoleDefinition("Reader"),
Check: resource.ComposeTestCheckFunc(
testAzureRMClientConfigAttr(dataSourceName, "id", "/providers/Microsoft.Authorization/roleDefinitions/acdd72a7-3385-48ef-bd42-f606fba81ae7"),
resource.TestCheckResourceAttr(dataSourceName, "id", "/providers/Microsoft.Authorization/roleDefinitions/acdd72a7-3385-48ef-bd42-f606fba81ae7"),
resource.TestCheckResourceAttrSet(dataSourceName, "description"),
resource.TestCheckResourceAttrSet(dataSourceName, "type"),
resource.TestCheckResourceAttr(dataSourceName, "permissions.#", "1"),
Expand All @@ -87,7 +87,7 @@ func TestAccDataSourceAzureRMBuiltInRoleDefinition_virtualMachineContributor(t *
{
Config: testAccDataSourceBuiltInRoleDefinition("VirtualMachineContributor"),
Check: resource.ComposeTestCheckFunc(
testAzureRMClientConfigAttr(dataSourceName, "id", "/providers/Microsoft.Authorization/roleDefinitions/9980e02c-c2be-4d73-94e8-173b1dc7cf3c"),
resource.TestCheckResourceAttr(dataSourceName, "id", "/providers/Microsoft.Authorization/roleDefinitions/9980e02c-c2be-4d73-94e8-173b1dc7cf3c"),
resource.TestCheckResourceAttrSet(dataSourceName, "description"),
resource.TestCheckResourceAttrSet(dataSourceName, "type"),
resource.TestCheckResourceAttr(dataSourceName, "permissions.#", "1"),
Expand Down
14 changes: 3 additions & 11 deletions azurerm/data_source_client_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ func TestAccDataSourceAzureRMClientConfig_basic(t *testing.T) {
{
Config: testAccCheckArmClientConfig_basic,
Check: resource.ComposeTestCheckFunc(
testAzureRMClientConfigAttr(dataSourceName, "client_id", clientId),
testAzureRMClientConfigAttr(dataSourceName, "tenant_id", tenantId),
testAzureRMClientConfigAttr(dataSourceName, "subscription_id", subscriptionId),
resource.TestCheckResourceAttr(dataSourceName, "client_id", clientId),
resource.TestCheckResourceAttr(dataSourceName, "tenant_id", tenantId),
resource.TestCheckResourceAttr(dataSourceName, "subscription_id", subscriptionId),
testAzureRMClientConfigGUIDAttr(dataSourceName, "service_principal_application_id"),
testAzureRMClientConfigGUIDAttr(dataSourceName, "service_principal_object_id"),
),
Expand All @@ -33,14 +33,6 @@ func TestAccDataSourceAzureRMClientConfig_basic(t *testing.T) {
})
}

// Wraps resource.TestCheckResourceAttr to prevent leaking values to console
// in case of mismatch
func testAzureRMClientConfigAttr(name, key, value string) resource.TestCheckFunc {
return func(s *terraform.State) error {
return resource.TestCheckResourceAttr(name, key, value)(s)
}
}

func testAzureRMClientConfigGUIDAttr(name, key string) resource.TestCheckFunc {
return func(s *terraform.State) error {
r, err := regexp.Compile("^[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}$")
Expand Down
26 changes: 13 additions & 13 deletions azurerm/data_source_policy_definition_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ func TestAccDataSourceAzureRMPolicyDefinition_builtIn(t *testing.T) {
{
Config: testAccDataSourceBuiltInPolicyDefinition("Allowed resource types"),
Check: resource.ComposeTestCheckFunc(
testAzureRMClientConfigAttr(dataSourceName, "id", "/providers/Microsoft.Authorization/policyDefinitions/a08ec900-254a-4555-9bf5-e42af04b5c5c"),
testAzureRMClientConfigAttr(dataSourceName, "name", "a08ec900-254a-4555-9bf5-e42af04b5c5c"),
testAzureRMClientConfigAttr(dataSourceName, "display_name", "Allowed resource types"),
testAzureRMClientConfigAttr(dataSourceName, "type", "Microsoft.Authorization/policyDefinitions"),
testAzureRMClientConfigAttr(dataSourceName, "description", "This policy enables you to specify the resource types that your organization can deploy. Only resource types that support 'tags' and 'location' will be affected by this policy. To restrict all resources please duplicate this policy and change the 'mode' to 'All'."),
resource.TestCheckResourceAttr(dataSourceName, "id", "/providers/Microsoft.Authorization/policyDefinitions/a08ec900-254a-4555-9bf5-e42af04b5c5c"),
resource.TestCheckResourceAttr(dataSourceName, "name", "a08ec900-254a-4555-9bf5-e42af04b5c5c"),
resource.TestCheckResourceAttr(dataSourceName, "display_name", "Allowed resource types"),
resource.TestCheckResourceAttr(dataSourceName, "type", "Microsoft.Authorization/policyDefinitions"),
resource.TestCheckResourceAttr(dataSourceName, "description", "This policy enables you to specify the resource types that your organization can deploy. Only resource types that support 'tags' and 'location' will be affected by this policy. To restrict all resources please duplicate this policy and change the 'mode' to 'All'."),
),
},
},
Expand All @@ -38,7 +38,7 @@ func TestAccDataSourceAzureRMPolicyDefinition_builtIn_AtManagementGroup(t *testi
{
Config: testAccDataSourceBuiltInPolicyDefinitionAtManagementGroup("Allowed resource types"),
Check: resource.ComposeTestCheckFunc(
testAzureRMClientConfigAttr(dataSourceName, "id", "/providers/Microsoft.Authorization/policyDefinitions/a08ec900-254a-4555-9bf5-e42af04b5c5c"),
resource.TestCheckResourceAttr(dataSourceName, "id", "/providers/Microsoft.Authorization/policyDefinitions/a08ec900-254a-4555-9bf5-e42af04b5c5c"),
),
},
},
Expand All @@ -56,13 +56,13 @@ func TestAccDataSourceAzureRMPolicyDefinition_custom(t *testing.T) {
Config: testAccDataSourceCustomPolicyDefinition(ri),
Check: resource.ComposeTestCheckFunc(
testAzureRMAttrExists(dataSourceName, "id"),
testAzureRMClientConfigAttr(dataSourceName, "name", fmt.Sprintf("acctestpol-%d", ri)),
testAzureRMClientConfigAttr(dataSourceName, "display_name", fmt.Sprintf("acctestpol-%d", ri)),
testAzureRMClientConfigAttr(dataSourceName, "type", "Microsoft.Authorization/policyDefinitions"),
testAzureRMClientConfigAttr(dataSourceName, "policy_type", "Custom"),
testAzureRMClientConfigAttr(dataSourceName, "policy_rule", "{\"if\":{\"not\":{\"field\":\"location\",\"in\":\"[parameters('allowedLocations')]\"}},\"then\":{\"effect\":\"audit\"}}"),
testAzureRMClientConfigAttr(dataSourceName, "parameters", "{\"allowedLocations\":{\"metadata\":{\"description\":\"The list of allowed locations for resources.\",\"displayName\":\"Allowed locations\",\"strongType\":\"location\"},\"type\":\"Array\"}}"),
testAzureRMClientConfigAttr(dataSourceName, "metadata", "{\"note\":\"azurerm acceptance test\"}"),
resource.TestCheckResourceAttr(dataSourceName, "name", fmt.Sprintf("acctestpol-%d", ri)),
resource.TestCheckResourceAttr(dataSourceName, "display_name", fmt.Sprintf("acctestpol-%d", ri)),
resource.TestCheckResourceAttr(dataSourceName, "type", "Microsoft.Authorization/policyDefinitions"),
resource.TestCheckResourceAttr(dataSourceName, "policy_type", "Custom"),
resource.TestCheckResourceAttr(dataSourceName, "policy_rule", "{\"if\":{\"not\":{\"field\":\"location\",\"in\":\"[parameters('allowedLocations')]\"}},\"then\":{\"effect\":\"audit\"}}"),
resource.TestCheckResourceAttr(dataSourceName, "parameters", "{\"allowedLocations\":{\"metadata\":{\"description\":\"The list of allowed locations for resources.\",\"displayName\":\"Allowed locations\",\"strongType\":\"location\"},\"type\":\"Array\"}}"),
resource.TestCheckResourceAttr(dataSourceName, "metadata", "{\"note\":\"azurerm acceptance test\"}"),
),
},
},
Expand Down
8 changes: 4 additions & 4 deletions azurerm/data_source_role_definition_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func TestAccDataSourceAzureRMRoleDefinition_builtIn_contributor(t *testing.T) {
{
Config: testAccDataSourceAzureRMRoleDefinition_builtIn("Contributor"),
Check: resource.ComposeTestCheckFunc(
testAzureRMClientConfigAttr(dataSourceName, "id", "/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c"),
resource.TestCheckResourceAttr(dataSourceName, "id", "/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c"),
resource.TestCheckResourceAttrSet(dataSourceName, "description"),
resource.TestCheckResourceAttrSet(dataSourceName, "type"),
resource.TestCheckResourceAttr(dataSourceName, "permissions.#", "1"),
Expand All @@ -103,7 +103,7 @@ func TestAccDataSourceAzureRMRoleDefinition_builtIn_owner(t *testing.T) {
{
Config: testAccDataSourceAzureRMRoleDefinition_builtIn("Owner"),
Check: resource.ComposeTestCheckFunc(
testAzureRMClientConfigAttr(dataSourceName, "id", "/providers/Microsoft.Authorization/roleDefinitions/8e3af657-a8ff-443c-a75c-2fe8c4bcb635"),
resource.TestCheckResourceAttr(dataSourceName, "id", "/providers/Microsoft.Authorization/roleDefinitions/8e3af657-a8ff-443c-a75c-2fe8c4bcb635"),
resource.TestCheckResourceAttrSet(dataSourceName, "description"),
resource.TestCheckResourceAttrSet(dataSourceName, "type"),
resource.TestCheckResourceAttr(dataSourceName, "permissions.#", "1"),
Expand All @@ -125,7 +125,7 @@ func TestAccDataSourceAzureRMRoleDefinition_builtIn_reader(t *testing.T) {
{
Config: testAccDataSourceAzureRMRoleDefinition_builtIn("Reader"),
Check: resource.ComposeTestCheckFunc(
testAzureRMClientConfigAttr(dataSourceName, "id", "/providers/Microsoft.Authorization/roleDefinitions/acdd72a7-3385-48ef-bd42-f606fba81ae7"),
resource.TestCheckResourceAttr(dataSourceName, "id", "/providers/Microsoft.Authorization/roleDefinitions/acdd72a7-3385-48ef-bd42-f606fba81ae7"),
resource.TestCheckResourceAttrSet(dataSourceName, "description"),
resource.TestCheckResourceAttrSet(dataSourceName, "type"),
resource.TestCheckResourceAttr(dataSourceName, "permissions.#", "1"),
Expand All @@ -147,7 +147,7 @@ func TestAccDataSourceAzureRMRoleDefinition_builtIn_virtualMachineContributor(t
{
Config: testAccDataSourceAzureRMRoleDefinition_builtIn("VirtualMachineContributor"),
Check: resource.ComposeTestCheckFunc(
testAzureRMClientConfigAttr(dataSourceName, "id", "/providers/Microsoft.Authorization/roleDefinitions/9980e02c-c2be-4d73-94e8-173b1dc7cf3c"),
resource.TestCheckResourceAttr(dataSourceName, "id", "/providers/Microsoft.Authorization/roleDefinitions/9980e02c-c2be-4d73-94e8-173b1dc7cf3c"),
resource.TestCheckResourceAttrSet(dataSourceName, "description"),
resource.TestCheckResourceAttrSet(dataSourceName, "type"),
resource.TestCheckResourceAttr(dataSourceName, "permissions.#", "1"),
Expand Down
2 changes: 2 additions & 0 deletions azurerm/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ func Provider() terraform.ResourceProvider {
"azurerm_api_management_group": resourceArmApiManagementGroup(),
"azurerm_api_management_group_user": resourceArmApiManagementGroupUser(),
"azurerm_api_management_product": resourceArmApiManagementProduct(),
"azurerm_api_management_product_group": resourceArmApiManagementProductGroup(),
"azurerm_api_management_property": resourceArmApiManagementProperty(),
"azurerm_api_management_user": resourceArmApiManagementUser(),
"azurerm_app_service_active_slot": resourceArmAppServiceActiveSlot(),
Expand Down Expand Up @@ -228,6 +229,7 @@ func Provider() terraform.ResourceProvider {
"azurerm_dns_txt_record": resourceArmDnsTxtRecord(),
"azurerm_dns_zone": resourceArmDnsZone(),
"azurerm_eventgrid_domain": resourceArmEventGridDomain(),
"azurerm_eventgrid_event_subscription": resourceArmEventGridEventSubscription(),
"azurerm_eventgrid_topic": resourceArmEventGridTopic(),
"azurerm_eventhub_authorization_rule": resourceArmEventHubAuthorizationRule(),
"azurerm_eventhub_consumer_group": resourceArmEventHubConsumerGroup(),
Expand Down
Loading

0 comments on commit 14d68f3

Please sign in to comment.