Skip to content

Commit

Permalink
azurerm_app_configuration - adding properties for data plane proxy …
Browse files Browse the repository at this point in the history
…configuration (hashicorp#28712)

* azurerm_app_configuration - add data plane proxy args

* minor fix

* same minor fix in data source
  • Loading branch information
sreallymatt authored and hqhqhqhqhqhqhqhqhqhqhq committed Feb 26, 2025
1 parent bc1034b commit e943302
Show file tree
Hide file tree
Showing 6 changed files with 249 additions and 152 deletions.
123 changes: 69 additions & 54 deletions internal/services/appconfiguration/app_configuration_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,80 +40,43 @@ func dataSourceAppConfiguration() *pluginsdk.Resource {

"location": commonschema.LocationComputed(),

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

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

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

"identity": commonschema.SystemAssignedUserAssignedIdentityComputed(),

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

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

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

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

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

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

"public_network_access": {
Type: pluginsdk.TypeString,
Computed: true,
},
"identity": commonschema.SystemAssignedUserAssignedIdentityComputed(),

"replica": {
Type: pluginsdk.TypeList,
"local_auth_enabled": {
Type: pluginsdk.TypeBool,
Computed: true,
Elem: &pluginsdk.Resource{
Schema: map[string]*pluginsdk.Schema{
"name": {
Type: pluginsdk.TypeString,
Computed: true,
},
"location": commonschema.LocationComputed(),
"endpoint": {
Type: pluginsdk.TypeString,
Computed: true,
},
"id": {
Type: pluginsdk.TypeString,
Computed: true,
},
},
},
},

"primary_read_key": {
Expand All @@ -140,7 +103,7 @@ func dataSourceAppConfiguration() *pluginsdk.Resource {
},
},

"secondary_read_key": {
"primary_write_key": {
Type: pluginsdk.TypeList,
Computed: true,
Elem: &pluginsdk.Resource{
Expand All @@ -164,7 +127,44 @@ func dataSourceAppConfiguration() *pluginsdk.Resource {
},
},

"primary_write_key": {
"public_network_access": {
Type: pluginsdk.TypeString,
Computed: true,
},

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

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

"replica": {
Type: pluginsdk.TypeList,
Computed: true,
Elem: &pluginsdk.Resource{
Schema: map[string]*pluginsdk.Schema{
"name": {
Type: pluginsdk.TypeString,
Computed: true,
},
"id": {
Type: pluginsdk.TypeString,
Computed: true,
},
"location": commonschema.LocationComputed(),
"endpoint": {
Type: pluginsdk.TypeString,
Computed: true,
},
},
},
},

"secondary_read_key": {
Type: pluginsdk.TypeList,
Computed: true,
Elem: &pluginsdk.Resource{
Expand Down Expand Up @@ -212,6 +212,16 @@ func dataSourceAppConfiguration() *pluginsdk.Resource {
},
},

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

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

"tags": commonschema.TagsDataSource(),
},
}
Expand Down Expand Up @@ -248,6 +258,11 @@ func dataSourceAppConfigurationRead(d *pluginsdk.ResourceData, meta interface{})
d.Set("sku", model.Sku.Name)

if props := model.Properties; props != nil {
if dataPlaneProxy := props.DataPlaneProxy; dataPlaneProxy != nil {
d.Set("data_plane_proxy_authentication_mode", string(pointer.From(dataPlaneProxy.AuthenticationMode)))
d.Set("data_plane_proxy_private_link_delegation_enabled", pointer.From(dataPlaneProxy.PrivateLinkDelegation) == configurationstores.PrivateLinkDelegationEnabled)
}

d.Set("endpoint", props.Endpoint)
d.Set("encryption", flattenAppConfigurationEncryption(props.Encryption))
d.Set("public_network_access", string(pointer.From(props.PublicNetworkAccess)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ func TestAccAppConfigurationDataSource_basic(t *testing.T) {
Config: AppConfigurationDataSource{}.basic(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(AppConfigurationResource{}),
check.That(data.ResourceName).Key("data_plane_proxy_authentication_mode").HasValue("Pass-through"),
check.That(data.ResourceName).Key("data_plane_proxy_private_link_delegation_enabled").HasValue("true"),
check.That(data.ResourceName).Key("endpoint").Exists(),
check.That(data.ResourceName).Key("encryption.#").HasValue("1"),
check.That(data.ResourceName).Key("encryption.0.key_vault_key_identifier").Exists(),
Expand Down Expand Up @@ -59,13 +61,12 @@ func TestAccAppConfigurationDataSource_basic(t *testing.T) {
}

func (AppConfigurationDataSource) basic(data acceptance.TestData) string {
template := AppConfigurationResource{}.complete(data)
return fmt.Sprintf(`
%s
data "azurerm_app_configuration" "test" {
name = azurerm_app_configuration.test.name
resource_group_name = azurerm_app_configuration.test.resource_group_name
}
`, template)
`, AppConfigurationResource{}.complete(data))
}
Loading

0 comments on commit e943302

Please sign in to comment.