terraform/builtin/providers/azurerm/resource_arm_cdn_endpoint.go

431 lines
11 KiB
Go
Raw Normal View History

package azurerm
2016-06-02 02:44:08 +02:00
import (
"bytes"
"fmt"
"log"
"net/http"
"strings"
"github.com/Azure/azure-sdk-for-go/arm/cdn"
"github.com/hashicorp/terraform/helper/hashcode"
"github.com/hashicorp/terraform/helper/schema"
)
func resourceArmCdnEndpoint() *schema.Resource {
return &schema.Resource{
Create: resourceArmCdnEndpointCreate,
Read: resourceArmCdnEndpointRead,
Update: resourceArmCdnEndpointUpdate,
Delete: resourceArmCdnEndpointDelete,
provider/azurerm: enable import of more resources (#10195) * provider/azurerm: support import of virtual_machine TF_ACC=1 go test ./builtin/providers/azurerm -v -run "TestAccAzureRMVirtualMachine_(basic|import)" -timeout 120m === RUN TestAccAzureRMVirtualMachine_importBasic --- PASS: TestAccAzureRMVirtualMachine_importBasic (561.08s) === RUN TestAccAzureRMVirtualMachine_basicLinuxMachine --- PASS: TestAccAzureRMVirtualMachine_basicLinuxMachine (677.49s) === RUN TestAccAzureRMVirtualMachine_basicLinuxMachine_disappears --- PASS: TestAccAzureRMVirtualMachine_basicLinuxMachine_disappears (674.21s) === RUN TestAccAzureRMVirtualMachine_basicWindowsMachine --- PASS: TestAccAzureRMVirtualMachine_basicWindowsMachine (1105.18s) PASS ok github.com/hashicorp/terraform/builtin/providers/azurerm 3017.970s * provider/azurerm: support import of servicebus_namespace TF_ACC=1 go test ./builtin/providers/azurerm -v -run TestAccAzureRMServiceBusNamespace_import -timeout 120m === RUN TestAccAzureRMServiceBusNamespace_importBasic --- PASS: TestAccAzureRMServiceBusNamespace_importBasic (345.80s) PASS ok github.com/hashicorp/terraform/builtin/providers/azurerm 345.879s * provider/azurerm: document import of servicebus_topic and servicebus_subscription * provider/azurerm: support import of dns record resources TF_ACC=1 go test ./builtin/providers/azurerm -v -run TestAccAzureRMDns[A-z]+Record_importBasic -timeout 120m === RUN TestAccAzureRMDnsARecord_importBasic --- PASS: TestAccAzureRMDnsARecord_importBasic (102.84s) === RUN TestAccAzureRMDnsAAAARecord_importBasic --- PASS: TestAccAzureRMDnsAAAARecord_importBasic (100.59s) === RUN TestAccAzureRMDnsCNameRecord_importBasic --- PASS: TestAccAzureRMDnsCNameRecord_importBasic (98.94s) === RUN TestAccAzureRMDnsMxRecord_importBasic --- PASS: TestAccAzureRMDnsMxRecord_importBasic (107.30s) === RUN TestAccAzureRMDnsNsRecord_importBasic --- PASS: TestAccAzureRMDnsNsRecord_importBasic (98.55s) === RUN TestAccAzureRMDnsSrvRecord_importBasic --- PASS: TestAccAzureRMDnsSrvRecord_importBasic (100.19s) === RUN TestAccAzureRMDnsTxtRecord_importBasic --- PASS: TestAccAzureRMDnsTxtRecord_importBasic (97.49s) PASS ok github.com/hashicorp/terraform/builtin/providers/azurerm 706.000s * provider/azurerm: support import of cdn_endpoint, document profile import TF_ACC=1 go test ./builtin/providers/azurerm -v -run TestAccAzureRMCdnEndpoint_import -timeout 120m === RUN TestAccAzureRMCdnEndpoint_importWithTags --- PASS: TestAccAzureRMCdnEndpoint_importWithTags (207.83s) PASS ok github.com/hashicorp/terraform/builtin/providers/azurerm 207.907s * provider/azurerm: support import of sql_server, fix sql_firewall import TF_ACC=1 go test ./builtin/providers/azurerm -v -run TestAccAzureRMSql[A-z]+_importBasic -timeout 120m === RUN TestAccAzureRMSqlFirewallRule_importBasic --- PASS: TestAccAzureRMSqlFirewallRule_importBasic (153.72s) === RUN TestAccAzureRMSqlServer_importBasic --- PASS: TestAccAzureRMSqlServer_importBasic (119.83s) PASS ok github.com/hashicorp/terraform/builtin/providers/azurerm 273.630s
2016-11-22 13:13:11 +01:00
Importer: &schema.ResourceImporter{
State: schema.ImportStatePassthrough,
},
2016-06-02 02:44:08 +02:00
Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"location": locationSchema(),
2016-06-02 02:44:08 +02:00
"resource_group_name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"profile_name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"origin_host_header": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"is_http_allowed": {
Type: schema.TypeBool,
Optional: true,
Default: true,
},
"is_https_allowed": {
Type: schema.TypeBool,
Optional: true,
Default: true,
},
"origin": {
Type: schema.TypeSet,
Required: true,
ForceNew: true,
2016-06-02 02:44:08 +02:00
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
},
"host_name": {
Type: schema.TypeString,
Required: true,
},
"http_port": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
"https_port": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
},
},
Set: resourceArmCdnEndpointOriginHash,
},
"origin_path": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"querystring_caching_behaviour": {
Type: schema.TypeString,
Optional: true,
Default: "IgnoreQueryString",
ValidateFunc: validateCdnEndpointQuerystringCachingBehaviour,
},
"content_types_to_compress": {
Type: schema.TypeSet,
Optional: true,
Computed: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
Set: schema.HashString,
},
"is_compression_enabled": {
Type: schema.TypeBool,
Optional: true,
Default: false,
},
"host_name": {
Type: schema.TypeString,
Computed: true,
},
"tags": tagsSchema(),
},
}
}
func resourceArmCdnEndpointCreate(d *schema.ResourceData, meta interface{}) error {
client := meta.(*ArmClient)
cdnEndpointsClient := client.cdnEndpointsClient
log.Printf("[INFO] preparing arguments for Azure ARM CDN EndPoint creation.")
name := d.Get("name").(string)
location := d.Get("location").(string)
resGroup := d.Get("resource_group_name").(string)
profileName := d.Get("profile_name").(string)
http_allowed := d.Get("is_http_allowed").(bool)
https_allowed := d.Get("is_https_allowed").(bool)
compression_enabled := d.Get("is_compression_enabled").(bool)
caching_behaviour := d.Get("querystring_caching_behaviour").(string)
tags := d.Get("tags").(map[string]interface{})
properties := cdn.EndpointProperties{
2016-06-02 02:44:08 +02:00
IsHTTPAllowed: &http_allowed,
IsHTTPSAllowed: &https_allowed,
IsCompressionEnabled: &compression_enabled,
QueryStringCachingBehavior: cdn.QueryStringCachingBehavior(caching_behaviour),
}
origins, originsErr := expandAzureRmCdnEndpointOrigins(d)
if originsErr != nil {
return fmt.Errorf("Error Building list of CDN Endpoint Origins: %s", originsErr)
}
if len(origins) > 0 {
properties.Origins = &origins
}
if v, ok := d.GetOk("origin_host_header"); ok {
host_header := v.(string)
properties.OriginHostHeader = &host_header
}
if v, ok := d.GetOk("origin_path"); ok {
origin_path := v.(string)
properties.OriginPath = &origin_path
}
if v, ok := d.GetOk("content_types_to_compress"); ok {
var content_types []string
ctypes := v.(*schema.Set).List()
for _, ct := range ctypes {
str := ct.(string)
content_types = append(content_types, str)
}
properties.ContentTypesToCompress = &content_types
}
cdnEndpoint := cdn.Endpoint{
Location: &location,
EndpointProperties: &properties,
Tags: expandTags(tags),
2016-06-02 02:44:08 +02:00
}
_, error := cdnEndpointsClient.Create(resGroup, profileName, name, cdnEndpoint, make(<-chan struct{}))
err := <-error
2016-06-02 02:44:08 +02:00
if err != nil {
return err
}
read, err := cdnEndpointsClient.Get(resGroup, profileName, name)
2016-06-02 02:44:08 +02:00
if err != nil {
return err
}
if read.ID == nil {
return fmt.Errorf("Cannot read CND Endpoint %s/%s (resource group %s) ID", profileName, name, resGroup)
}
d.SetId(*read.ID)
return resourceArmCdnEndpointRead(d, meta)
}
func resourceArmCdnEndpointRead(d *schema.ResourceData, meta interface{}) error {
cdnEndpointsClient := meta.(*ArmClient).cdnEndpointsClient
id, err := parseAzureResourceID(d.Id())
if err != nil {
return err
}
resGroup := id.ResourceGroup
name := id.Path["endpoints"]
profileName := id.Path["profiles"]
if profileName == "" {
profileName = id.Path["Profiles"]
}
log.Printf("[INFO] Trying to find the AzureRM CDN Endpoint %s (Profile: %s, RG: %s)", name, profileName, resGroup)
resp, err := cdnEndpointsClient.Get(resGroup, profileName, name)
provider/azurerm: Reordering the checks after an Azure API Get We are receiving suggestions of a panic as follows: ``` 2016/09/01 07:21:55 [DEBUG] plugin: terraform: panic: runtime error: invalid memory address or nil pointer dereference 2016/09/01 07:21:55 [DEBUG] plugin: terraform: [signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0xa3170f] 2016/09/01 07:21:55 [DEBUG] plugin: terraform: 2016/09/01 07:21:55 [DEBUG] plugin: terraform: goroutine 114 [running]: 2016/09/01 07:21:55 [DEBUG] plugin: terraform: panic(0x27f4e60, 0xc4200100e0) 2016/09/01 07:21:55 [DEBUG] plugin: terraform: /opt/go/src/runtime/panic.go:500 +0x1a1 2016/09/01 07:21:55 [DEBUG] plugin: terraform: github.com/hashicorp/terraform/builtin/providers/azurerm.resourceArmVirtualMachineRead(0xc4206d8060, 0x2995620, 0xc4204d0000, 0x0, 0x17) 2016/09/01 07:21:55 [DEBUG] plugin: terraform: /opt/gopath/src/github.com/hashicorp/terraform/builtin/providers/azurerm/resource_arm_virtual_machine.go:488 +0x1ff 2016/09/01 07:21:55 [DEBUG] plugin: terraform: github.com/hashicorp/terraform/helper/schema.(*Resource).Refresh(0xc420017a40, 0xc42040c780, 0x2995620, 0xc4204d0000, 0xc42019c990, 0x1, 0x0) ``` This is because the code is as follows: ``` resp, err := client.Get(resGroup, vnetName, name) if resp.StatusCode == http.StatusNotFound { d.SetId("") return nil } if err != nil { return fmt.Errorf("Error making Read request on Azure virtual network peering %s: %s", name, err) } ``` When a request throws an error, the response object isn't valid. Therefore, we need to flip that code to check the error first ``` resp, err := client.Get(resGroup, vnetName, name) if err != nil { return fmt.Errorf("Error making Read request on Azure virtual network peering %s: %s", name, err) } if resp.StatusCode == http.StatusNotFound { d.SetId("") return nil } ```
2016-09-01 16:31:42 +02:00
if err != nil {
if resp.StatusCode == http.StatusNotFound {
d.SetId("")
return nil
}
provider/azurerm: Reordering the checks after an Azure API Get We are receiving suggestions of a panic as follows: ``` 2016/09/01 07:21:55 [DEBUG] plugin: terraform: panic: runtime error: invalid memory address or nil pointer dereference 2016/09/01 07:21:55 [DEBUG] plugin: terraform: [signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0xa3170f] 2016/09/01 07:21:55 [DEBUG] plugin: terraform: 2016/09/01 07:21:55 [DEBUG] plugin: terraform: goroutine 114 [running]: 2016/09/01 07:21:55 [DEBUG] plugin: terraform: panic(0x27f4e60, 0xc4200100e0) 2016/09/01 07:21:55 [DEBUG] plugin: terraform: /opt/go/src/runtime/panic.go:500 +0x1a1 2016/09/01 07:21:55 [DEBUG] plugin: terraform: github.com/hashicorp/terraform/builtin/providers/azurerm.resourceArmVirtualMachineRead(0xc4206d8060, 0x2995620, 0xc4204d0000, 0x0, 0x17) 2016/09/01 07:21:55 [DEBUG] plugin: terraform: /opt/gopath/src/github.com/hashicorp/terraform/builtin/providers/azurerm/resource_arm_virtual_machine.go:488 +0x1ff 2016/09/01 07:21:55 [DEBUG] plugin: terraform: github.com/hashicorp/terraform/helper/schema.(*Resource).Refresh(0xc420017a40, 0xc42040c780, 0x2995620, 0xc4204d0000, 0xc42019c990, 0x1, 0x0) ``` This is because the code is as follows: ``` resp, err := client.Get(resGroup, vnetName, name) if resp.StatusCode == http.StatusNotFound { d.SetId("") return nil } if err != nil { return fmt.Errorf("Error making Read request on Azure virtual network peering %s: %s", name, err) } ``` When a request throws an error, the response object isn't valid. Therefore, we need to flip that code to check the error first ``` resp, err := client.Get(resGroup, vnetName, name) if err != nil { return fmt.Errorf("Error making Read request on Azure virtual network peering %s: %s", name, err) } if resp.StatusCode == http.StatusNotFound { d.SetId("") return nil } ```
2016-09-01 16:31:42 +02:00
return fmt.Errorf("Error making Read request on Azure CDN Endpoint %s: %s", name, err)
}
2016-06-02 02:44:08 +02:00
d.Set("name", resp.Name)
provider/azurerm: enable import of more resources (#10195) * provider/azurerm: support import of virtual_machine TF_ACC=1 go test ./builtin/providers/azurerm -v -run "TestAccAzureRMVirtualMachine_(basic|import)" -timeout 120m === RUN TestAccAzureRMVirtualMachine_importBasic --- PASS: TestAccAzureRMVirtualMachine_importBasic (561.08s) === RUN TestAccAzureRMVirtualMachine_basicLinuxMachine --- PASS: TestAccAzureRMVirtualMachine_basicLinuxMachine (677.49s) === RUN TestAccAzureRMVirtualMachine_basicLinuxMachine_disappears --- PASS: TestAccAzureRMVirtualMachine_basicLinuxMachine_disappears (674.21s) === RUN TestAccAzureRMVirtualMachine_basicWindowsMachine --- PASS: TestAccAzureRMVirtualMachine_basicWindowsMachine (1105.18s) PASS ok github.com/hashicorp/terraform/builtin/providers/azurerm 3017.970s * provider/azurerm: support import of servicebus_namespace TF_ACC=1 go test ./builtin/providers/azurerm -v -run TestAccAzureRMServiceBusNamespace_import -timeout 120m === RUN TestAccAzureRMServiceBusNamespace_importBasic --- PASS: TestAccAzureRMServiceBusNamespace_importBasic (345.80s) PASS ok github.com/hashicorp/terraform/builtin/providers/azurerm 345.879s * provider/azurerm: document import of servicebus_topic and servicebus_subscription * provider/azurerm: support import of dns record resources TF_ACC=1 go test ./builtin/providers/azurerm -v -run TestAccAzureRMDns[A-z]+Record_importBasic -timeout 120m === RUN TestAccAzureRMDnsARecord_importBasic --- PASS: TestAccAzureRMDnsARecord_importBasic (102.84s) === RUN TestAccAzureRMDnsAAAARecord_importBasic --- PASS: TestAccAzureRMDnsAAAARecord_importBasic (100.59s) === RUN TestAccAzureRMDnsCNameRecord_importBasic --- PASS: TestAccAzureRMDnsCNameRecord_importBasic (98.94s) === RUN TestAccAzureRMDnsMxRecord_importBasic --- PASS: TestAccAzureRMDnsMxRecord_importBasic (107.30s) === RUN TestAccAzureRMDnsNsRecord_importBasic --- PASS: TestAccAzureRMDnsNsRecord_importBasic (98.55s) === RUN TestAccAzureRMDnsSrvRecord_importBasic --- PASS: TestAccAzureRMDnsSrvRecord_importBasic (100.19s) === RUN TestAccAzureRMDnsTxtRecord_importBasic --- PASS: TestAccAzureRMDnsTxtRecord_importBasic (97.49s) PASS ok github.com/hashicorp/terraform/builtin/providers/azurerm 706.000s * provider/azurerm: support import of cdn_endpoint, document profile import TF_ACC=1 go test ./builtin/providers/azurerm -v -run TestAccAzureRMCdnEndpoint_import -timeout 120m === RUN TestAccAzureRMCdnEndpoint_importWithTags --- PASS: TestAccAzureRMCdnEndpoint_importWithTags (207.83s) PASS ok github.com/hashicorp/terraform/builtin/providers/azurerm 207.907s * provider/azurerm: support import of sql_server, fix sql_firewall import TF_ACC=1 go test ./builtin/providers/azurerm -v -run TestAccAzureRMSql[A-z]+_importBasic -timeout 120m === RUN TestAccAzureRMSqlFirewallRule_importBasic --- PASS: TestAccAzureRMSqlFirewallRule_importBasic (153.72s) === RUN TestAccAzureRMSqlServer_importBasic --- PASS: TestAccAzureRMSqlServer_importBasic (119.83s) PASS ok github.com/hashicorp/terraform/builtin/providers/azurerm 273.630s
2016-11-22 13:13:11 +01:00
d.Set("resource_group_name", resGroup)
d.Set("location", azureRMNormalizeLocation(*resp.Location))
d.Set("profile_name", profileName)
d.Set("host_name", resp.EndpointProperties.HostName)
d.Set("is_compression_enabled", resp.EndpointProperties.IsCompressionEnabled)
d.Set("is_http_allowed", resp.EndpointProperties.IsHTTPAllowed)
d.Set("is_https_allowed", resp.EndpointProperties.IsHTTPSAllowed)
d.Set("querystring_caching_behaviour", resp.EndpointProperties.QueryStringCachingBehavior)
if resp.EndpointProperties.OriginHostHeader != nil && *resp.EndpointProperties.OriginHostHeader != "" {
d.Set("origin_host_header", resp.EndpointProperties.OriginHostHeader)
2016-06-02 02:44:08 +02:00
}
if resp.EndpointProperties.OriginPath != nil && *resp.EndpointProperties.OriginPath != "" {
d.Set("origin_path", resp.EndpointProperties.OriginPath)
2016-06-02 02:44:08 +02:00
}
if resp.EndpointProperties.ContentTypesToCompress != nil {
d.Set("content_types_to_compress", flattenAzureRMCdnEndpointContentTypes(resp.EndpointProperties.ContentTypesToCompress))
2016-06-02 02:44:08 +02:00
}
d.Set("origin", flattenAzureRMCdnEndpointOrigin(resp.EndpointProperties.Origins))
2016-06-02 02:44:08 +02:00
flattenAndSetTags(d, resp.Tags)
return nil
}
func resourceArmCdnEndpointUpdate(d *schema.ResourceData, meta interface{}) error {
cdnEndpointsClient := meta.(*ArmClient).cdnEndpointsClient
if !d.HasChange("tags") {
return nil
}
name := d.Get("name").(string)
resGroup := d.Get("resource_group_name").(string)
profileName := d.Get("profile_name").(string)
http_allowed := d.Get("is_http_allowed").(bool)
https_allowed := d.Get("is_https_allowed").(bool)
compression_enabled := d.Get("is_compression_enabled").(bool)
caching_behaviour := d.Get("querystring_caching_behaviour").(string)
newTags := d.Get("tags").(map[string]interface{})
properties := cdn.EndpointPropertiesUpdateParameters{
2016-06-02 02:44:08 +02:00
IsHTTPAllowed: &http_allowed,
IsHTTPSAllowed: &https_allowed,
IsCompressionEnabled: &compression_enabled,
QueryStringCachingBehavior: cdn.QueryStringCachingBehavior(caching_behaviour),
}
if d.HasChange("origin_host_header") {
host_header := d.Get("origin_host_header").(string)
properties.OriginHostHeader = &host_header
}
if d.HasChange("origin_path") {
origin_path := d.Get("origin_path").(string)
properties.OriginPath = &origin_path
}
if d.HasChange("content_types_to_compress") {
var content_types []string
ctypes := d.Get("content_types_to_compress").(*schema.Set).List()
for _, ct := range ctypes {
str := ct.(string)
content_types = append(content_types, str)
}
properties.ContentTypesToCompress = &content_types
}
updateProps := cdn.EndpointUpdateParameters{
Tags: expandTags(newTags),
EndpointPropertiesUpdateParameters: &properties,
2016-06-02 02:44:08 +02:00
}
_, error := cdnEndpointsClient.Update(resGroup, profileName, name, updateProps, make(<-chan struct{}))
err := <-error
2016-06-02 02:44:08 +02:00
if err != nil {
return fmt.Errorf("Error issuing Azure ARM update request to update CDN Endpoint %q: %s", name, err)
}
return resourceArmCdnEndpointRead(d, meta)
}
func resourceArmCdnEndpointDelete(d *schema.ResourceData, meta interface{}) error {
client := meta.(*ArmClient).cdnEndpointsClient
id, err := parseAzureResourceID(d.Id())
if err != nil {
return err
}
resGroup := id.ResourceGroup
profileName := id.Path["profiles"]
if profileName == "" {
profileName = id.Path["Profiles"]
}
name := id.Path["endpoints"]
accResp, error := client.Delete(resGroup, profileName, name, make(<-chan struct{}))
resp := <-accResp
err = <-error
2016-06-02 02:44:08 +02:00
if err != nil {
if resp.StatusCode == http.StatusNotFound {
2016-06-02 02:44:08 +02:00
return nil
}
return fmt.Errorf("Error issuing AzureRM delete request for CDN Endpoint %q: %s", name, err)
}
return nil
2016-06-02 02:44:08 +02:00
}
func validateCdnEndpointQuerystringCachingBehaviour(v interface{}, k string) (ws []string, errors []error) {
value := strings.ToLower(v.(string))
cachingTypes := map[string]bool{
"ignorequerystring": true,
"bypasscaching": true,
"usequerystring": true,
}
if !cachingTypes[value] {
errors = append(errors, fmt.Errorf("CDN Endpoint querystringCachingBehaviours can only be IgnoreQueryString, BypassCaching or UseQueryString"))
}
return
}
func resourceArmCdnEndpointOriginHash(v interface{}) int {
var buf bytes.Buffer
m := v.(map[string]interface{})
buf.WriteString(fmt.Sprintf("%s-", m["name"].(string)))
buf.WriteString(fmt.Sprintf("%s-", m["host_name"].(string)))
return hashcode.String(buf.String())
}
func expandAzureRmCdnEndpointOrigins(d *schema.ResourceData) ([]cdn.DeepCreatedOrigin, error) {
configs := d.Get("origin").(*schema.Set).List()
origins := make([]cdn.DeepCreatedOrigin, 0, len(configs))
for _, configRaw := range configs {
data := configRaw.(map[string]interface{})
host_name := data["host_name"].(string)
properties := cdn.DeepCreatedOriginProperties{
HostName: &host_name,
}
if v, ok := data["https_port"]; ok {
https_port := int32(v.(int))
properties.HTTPSPort = &https_port
}
if v, ok := data["http_port"]; ok {
http_port := int32(v.(int))
properties.HTTPPort = &http_port
}
name := data["name"].(string)
origin := cdn.DeepCreatedOrigin{
Name: &name,
DeepCreatedOriginProperties: &properties,
2016-06-02 02:44:08 +02:00
}
origins = append(origins, origin)
}
return origins, nil
}
func flattenAzureRMCdnEndpointOrigin(list *[]cdn.DeepCreatedOrigin) []map[string]interface{} {
result := make([]map[string]interface{}, 0, len(*list))
for _, i := range *list {
l := map[string]interface{}{
"name": *i.Name,
"host_name": *i.DeepCreatedOriginProperties.HostName,
2016-06-02 02:44:08 +02:00
}
if i.DeepCreatedOriginProperties.HTTPPort != nil {
l["http_port"] = *i.DeepCreatedOriginProperties.HTTPPort
2016-06-02 02:44:08 +02:00
}
if i.DeepCreatedOriginProperties.HTTPSPort != nil {
l["https_port"] = *i.DeepCreatedOriginProperties.HTTPSPort
2016-06-02 02:44:08 +02:00
}
result = append(result, l)
}
return result
}
func flattenAzureRMCdnEndpointContentTypes(list *[]string) []interface{} {
vs := make([]interface{}, 0, len(*list))
for _, v := range *list {
vs = append(vs, v)
}
return vs
}