Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azurerm_app_service_environment_v3 - update for SDK supported GA changes to service #12932

Merged
merged 23 commits into from
Aug 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
c1092ce
update for GA changes to service
jackofallops Jul 27, 2021
32f5410
typo in test config
jackofallops Jul 27, 2021
9664e68
update datasource schema to computed only, add properties to test
jackofallops Jul 27, 2021
1279a6a
fix test config references
jackofallops Jul 27, 2021
4d660f1
increase tolerance for 404 after creation
jackofallops Jul 28, 2021
66d954e
wrong config used for template in updateVnet test
jackofallops Jul 28, 2021
920a1c4
missed schema item in datasource
jackofallops Jul 28, 2021
5aaf6ab
tidy schemas and update tests
jackofallops Jul 28, 2021
6d1994d
update docs
jackofallops Jul 28, 2021
6b9fd50
descope properties not supported by SDK (yet)
jackofallops Aug 10, 2021
1da0fdd
remove zone_redundant from data source
jackofallops Aug 10, 2021
01b8474
whitespace
jackofallops Aug 10, 2021
7eae299
linting updates, error checking iterator
jackofallops Aug 11, 2021
8a3b8df
re-introduce zoneRedundant and dedicated
jackofallops Aug 12, 2021
9f61b43
fix datasource test
jackofallops Aug 12, 2021
76c3c0c
fix resource tests
jackofallops Aug 12, 2021
cab7e86
add tests for dedicated and zone redundant deployments
jackofallops Aug 12, 2021
0e4790e
whitespace
jackofallops Aug 12, 2021
1a2b978
remove dedicated from Attributes
jackofallops Aug 12, 2021
e409afb
fix resource group reference for vnet update test
jackofallops Aug 12, 2021
46e9afa
make subnet ForceNew again until changevnet supported by service. Add…
jackofallops Aug 16, 2021
38d8a59
disable changeVnet test until service team implements it in service
jackofallops Aug 16, 2021
de5e3fd
tweak completeUpdate test
jackofallops Aug 16, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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