Skip to content

Commit

Permalink
azurerm_app_service_environment_v3 - update for SDK supported GA ch…
Browse files Browse the repository at this point in the history
…anges to service (#12932)
  • Loading branch information
jackofallops authored Aug 18, 2021
1 parent e2ca922 commit d2724a9
Show file tree
Hide file tree
Showing 6 changed files with 560 additions and 75 deletions.
121 changes: 116 additions & 5 deletions internal/services/web/app_service_environment_v3_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ func (r AppServiceEnvironmentV3DataSource) Arguments() map[string]*pluginsdk.Sch

func (r AppServiceEnvironmentV3DataSource) Attributes() map[string]*pluginsdk.Schema {
return map[string]*pluginsdk.Schema{
"subnet_id": {
Type: pluginsdk.TypeString,
"allow_new_private_endpoint_connections": {
Type: pluginsdk.TypeBool,
Computed: true,
},

Expand All @@ -56,16 +56,107 @@ func (r AppServiceEnvironmentV3DataSource) Attributes() map[string]*pluginsdk.Sc
},
},

"pricing_tier": {
"dedicated_host_count": {
Type: pluginsdk.TypeInt,
Computed: true,
},

"dns_suffix": {
Type: pluginsdk.TypeString,
Computed: true,
},

"external_inbound_ip_addresses": {
Type: pluginsdk.TypeList,
Computed: true,
Elem: &pluginsdk.Schema{
Type: pluginsdk.TypeString,
},
},

"inbound_network_dependencies": {
Type: pluginsdk.TypeList,
Computed: true,
Elem: &pluginsdk.Resource{
Schema: map[string]*pluginsdk.Schema{
"description": {
Type: pluginsdk.TypeString,
Computed: true,
},

"ip_addresses": {
Type: pluginsdk.TypeList,
Computed: true,
Elem: &pluginsdk.Schema{
Type: pluginsdk.TypeString,
},
},

"ports": {
Type: pluginsdk.TypeList,
Computed: true,
Elem: &pluginsdk.Schema{
Type: pluginsdk.TypeString,
},
},
},
},
},

"internal_inbound_ip_addresses": {
Type: pluginsdk.TypeList,
Computed: true,
Elem: &pluginsdk.Schema{
Type: pluginsdk.TypeString,
},
},

"internal_load_balancing_mode": {
Type: pluginsdk.TypeString,
Computed: true,
},

"linux_outbound_ip_addresses": {
Type: pluginsdk.TypeList,
Computed: true,
Elem: &pluginsdk.Schema{
Type: pluginsdk.TypeString,
},
},

"location": {
Type: pluginsdk.TypeString,
Computed: true,
},

"pricing_tier": {
Type: pluginsdk.TypeString,
Computed: true,
},

"ip_ssl_address_count": {
Type: pluginsdk.TypeInt,
Computed: true,
},

"subnet_id": {
Type: pluginsdk.TypeString,
Computed: true,
},

"windows_outbound_ip_addresses": {
Type: pluginsdk.TypeList,
Computed: true,
Elem: &pluginsdk.Schema{
Type: pluginsdk.TypeString,
},
},

"zone_redundant": {
Type: pluginsdk.TypeBool,
Computed: true,
},

"tags": tags.SchemaDataSource(),
}
}
Expand Down Expand Up @@ -111,11 +202,31 @@ func (r AppServiceEnvironmentV3DataSource) Read() sdk.ResourceFunc {
if props.VirtualNetwork != nil {
model.SubnetId = utils.NormalizeNilableString(props.VirtualNetwork.ID)
}

model.InternalLoadBalancingMode = string(props.InternalLoadBalancingMode)
model.DedicatedHostCount = int(utils.NormaliseNilableInt32(props.DedicatedHostCount))
model.PricingTier = utils.NormalizeNilableString(props.MultiSize)

model.ClusterSetting = flattenClusterSettingsModel(props.ClusterSettings)
model.DnsSuffix = utils.NormalizeNilableString(props.DNSSuffix)
model.IpSSLAddressCount = int(utils.NormaliseNilableInt32(existing.IpsslAddressCount))
model.ZoneRedundant = *props.ZoneRedundant
}

existingNetwork, err := client.GetAseV3NetworkingConfiguration(ctx, id.ResourceGroup, id.HostingEnvironmentName)
if err != nil {
return fmt.Errorf("reading network configuration for %s: %+v", id, err)
}

if props := existingNetwork.AseV3NetworkingConfigurationProperties; props != nil {
model.WindowsOutboundIPAddresses = *props.WindowsOutboundIPAddresses
model.LinuxOutboundIPAddresses = *props.LinuxOutboundIPAddresses
model.AllowNewPrivateEndpointConnections = *props.AllowNewPrivateEndpointConnections
}

inboundNetworkDependencies, err := flattenInboundNetworkDependencies(ctx, client, &id)
if err != nil {
return err
}
model.InboundNetworkDependencies = *inboundNetworkDependencies

model.Tags = tags.Flatten(existing.Tags)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@ func TestAccAppServiceEnvironmentV3DataSource_basic(t *testing.T) {
{
Config: AppServiceEnvironmentV3DataSource{}.basic(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).Key("cluster_setting.#").HasValue("2"),
check.That(data.ResourceName).Key("tags.%").HasValue("2"),
check.That(data.ResourceName).Key("cluster_setting.#").HasValue("3"),
check.That(data.ResourceName).Key("dns_suffix").HasValue(fmt.Sprintf("acctest-ase-%d.appserviceenvironment.net", data.RandomInteger)),
check.That(data.ResourceName).Key("ip_ssl_address_count").HasValue("0"),
check.That(data.ResourceName).Key("inbound_network_dependencies.#").HasValue("3"),
check.That(data.ResourceName).Key("linux_outbound_ip_addresses.#").HasValue("2"),
check.That(data.ResourceName).Key("location").HasValue(data.Locations.Primary),
check.That(data.ResourceName).Key("windows_outbound_ip_addresses.#").HasValue("2"),
),
},
})
Expand Down
Loading

0 comments on commit d2724a9

Please sign in to comment.