TheCloudTheory / arm-estimator

ACE (Azure Cost Estimator) - automated cost estimations for ARM Templates, Bicep and Terraform
MIT License
165 stars 13 forks source link

Unhandled exception: System.IndexOutOfRangeException: Index was outside the bounds of the array at PostgreSQLFlexibleQueryFilter #261

Closed reijoh closed 2 months ago

reijoh commented 4 months ago

About environment

Result


                                              .***      ***                                         
                                   ,    ***.********,****                                           
                                     **********************                                         
                               *    ************. ***********  *                                    
                             ///   *******, ****  ////////////******                                
                               .//************ ///// /////////********                              
                           ///////// ********///////// //////.********    (,                        
                     .   ///////////// **** ////////////,////******* ( (/                           
                       *////////////////   ////////////////  ** ((((((((((((                        
                        ///,  */////////.   **************,    ((((((((((((((                       
                       ///////////////.(((((((,******** ///// (((((( (((((((((                      
                       ///////////// ((((((((((((   ////////// ((((((((((*((((                      
                        ////////// ((((((((((( ((    //////////(((((((((((((((                      
                    //   /////// (((((( (((((((((((((((( ///////(((((((((((((                       
                       //   /  ( ((((((((((((((((,((((((((((.////(((((((((  ((                      

                                  ACE (Azure Cost Estimator) [1.4]

General help: https://github.com/TheCloudTheory/arm-estimator/discussions
Bugs & issues: https://github.com/TheCloudTheory/arm-estimator/issues

------------------------------

New version of ACE is available. Current version: 1.4, latest version: 1.5-beta1
Please update ACE to the latest version.

------------------------------

Run configuration:

-> Scope: Subscription
-> Susbcription Id: 9a731c75-8f79-4ce6-bdc3-543435967988
-> Template file: /home/runner/work/vebtst/vebtst/bicep/spoke/main.json
-> Deployment mode: Incremental
-> Threshold: 
-> Parameters file: main.parameters.json
-> Currency: EUR
-> Generate JSON output: True
-> Silent mode: False
-> Redirect stdout: False
-> Disabled detailed metrics: False
-> Generate HTML output: False
-> HTML output filename: Not Set
-> Dry run enabled: False
-> Cache disabled: True
-> Cache handler: Disabled
-> Conversion rate: 1
-> Webhook URL: Disabled

------------------------------

What If status:

-> Cache is disabled.
-> Waiting for response from What If API.
-> Detected 31 resources.

[Modify] d-vebtst [Microsoft.Resources/resourceGroups]
[NoChange] d-vebtst-audit [Microsoft.Resources/resourceGroups]
[Ignore] d-vebtst-audit-governance-egst [Microsoft.EventGrid/systemTopics]
[Modify] d-vebtst-network [Microsoft.Resources/resourceGroups]
[Ignore] d-vebtst-network-vnet-BackendSubnet-nsg [Microsoft.Network/networkSecurityGroups]
[Ignore] d-vebtst-network-vnet-FrontendSubnet-nsg [Microsoft.Network/networkSecurityGroups]
[Ignore] d-vebtst-networkwatcher [Microsoft.Network/networkWatchers]
[Ignore] BackendSubnet-flowlog [Microsoft.Network/networkWatchers/flowLogs]
[Ignore] FrontendSubnet-flowlog [Microsoft.Network/networkWatchers/flowLogs]
[Ignore] d-vebtst-network-vnet [Microsoft.Network/virtualNetworks]
[Ignore] dvebtstnetworkdiagc3vlxj [Microsoft.Storage/storageAccounts]
[NoChange] d-vebtst-psql2 [Microsoft.Resources/resourceGroups]
[Ignore] d-vebtstc3vlxj-psql [Microsoft.DBforPostgreSQL/flexibleServers]
[Ignore] d-vebtst-psql2c3vlxj-kv [Microsoft.KeyVault/vaults]
[Ignore] Failure Anomalies - d-vebtst-insights [microsoft.alertsmanagement/smartDetectorAlertRules]
[Ignore] Failure Anomalies - d-vebtst-insights2 [microsoft.alertsmanagement/smartDetectorAlertRules]
[Ignore] dvebtstc3vlxj [Microsoft.ContainerRegistry/registries]
[Ignore] dvebtstcachec3vlxj [Microsoft.ContainerRegistry/registries]
[Ignore] Application Insights Smart Detection [microsoft.insights/actiongroups]
[Ignore] d-vebtst-insights [Microsoft.Insights/components]
[Ignore] d-vebtst-insights2 [Microsoft.Insights/components]
[Ignore] d-vebtstc3vlxj-kv [Microsoft.KeyVault/vaults]
[NoChange] d-vebtst-kv-mi [Microsoft.ManagedIdentity/userAssignedIdentities]
[Ignore] pep-d-vebtst-webapp-sites-0.nic.f069fc7f-e0bf-4789-8252-df07200cf3c5 [Microsoft.Network/networkInterfaces]
[Ignore] webAppPrivateEndpoint.nic.d997d68a-af67-4a91-a50f-91a7d0d45e73 [Microsoft.Network/networkInterfaces]
[Ignore] pep-d-vebtst-webapp-sites-0 [Microsoft.Network/privateEndpoints]
[Ignore] webAppPrivateEndpoint [Microsoft.Network/privateEndpoints]
[Ignore] dvebtsttestkeysc3vlxj [Microsoft.Storage/storageAccounts]
[Ignore] p-we1waf-pubonnbmumf-kv-star21-astrupfearnley-net [Microsoft.Web/certificates]
[Ignore] d-vebtst-linuxAppServiceplan [Microsoft.Web/serverFarms]
[Ignore] d-vebtst-webapp [Microsoft.Web/sites]

-------------------------------

Estimations:

[Ignore] d-vebtst-audit-governance-egst
   \--- Type: Microsoft.EventGrid/systemTopics
   \--- Location: global
   \--- Total cost: 0.00 EUR
   \--- Delta: 0.00 EUR

Aggregated metrics:

No metrics available.

Used metrics:

No metrics available.

-------------------------------

[Warning] Cannot build filter for Virtual Network if properies are not available.
[Warning] Got no records for Microsoft.Network/virtualNetworks from Retail API

[Ignore] dvebtstnetworkdiagc3vlxj
   \--- Type: Microsoft.Storage/storageAccounts
   \--- Location: westeurope
   \--- Total cost: 0.12 EUR
   \--- Delta: 0.00 EUR

Aggregated metrics:

-> LRS Data Stored [0.1056 EUR]
-> Class 2 Operations [0.0037 EUR]
-> LRS Class 1 Additional IO [0.0037 EUR]
-> LRS Class 2 Additional IO [0.0037 EUR]
-> LRS Class 1 Operations [0.0037 EUR]
-> Batch Write Operations [0.0003 EUR]
-> Scan Operations [0.0003 EUR]
-> List Operations [0.0003 EUR]
-> Read Operations [0.0006 EUR]
-> Write Operations [0.0003 EUR]
-> Delete Operations [0.0006 EUR]
-> All Other Operations [0.0003 EUR]
-> LRS Write Operations [0.0003 EUR]
-> LRS List and Create Container Operations [0.0003 EUR]
-> Read Operations - Free [0 EUR]
-> LRS Write Operations - Free [0 EUR]

Used metrics:

-> Standard LRS | Tables | LRS Data Stored | 0.0417 for 1 GB/Month
-> Standard LRS | Queues v2 | LRS Data Stored | 0.0417 for 1 GB/Month
-> Standard LRS | General Block Blob | LRS Data Stored | 0.0222 for 1 GB/Month
-> Standard LRS | Queues v2 | Class 2 Operations | 0.0037 for 10K
-> Standard LRS | Queues v2 | LRS Class 1 Additional IO | 0.0037 for 10K
-> Standard LRS | Queues v2 | LRS Class 2 Additional IO | 0.0037 for 10K
-> Standard LRS | Queues v2 | LRS Class 1 Operations | 0.0037 for 10K
-> Standard LRS | Tables | Batch Write Operations | 0.0003 for 10K
-> Standard LRS | Tables | Scan Operations | 0.0003 for 10K
-> Standard LRS | Tables | List Operations | 0.0003 for 10K
-> Standard LRS | General Block Blob | Read Operations | 0.0003 for 10K
-> Standard LRS | Tables | Write Operations | 0.0003 for 10K
-> Standard LRS | General Block Blob | Delete Operations | 0.0003 for 10K
-> Standard LRS | General Block Blob | All Other Operations | 0.0003 for 10K
-> Standard LRS | General Block Blob | LRS Write Operations | 0.0003 for 10K
-> Standard LRS | General Block Blob | LRS List and Create Container Operations | 0.0003 for 10K
-> Standard LRS | Tables | Read Operations | 0.0003 for 10K
-> Standard LRS | Tables | Delete Operations | 0.0003 for 10K
-> Standard LRS | General Block Blob | Read Operations - Free | 0 for 10K
-> Standard LRS | General Block Blob | LRS Write Operations - Free | 0 for 10K

-------------------------------

Unhandled exception: System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at PostgreSQLFlexibleQueryFilter.GetFiltersBasedOnDesiredState(String location) in /home/runner/work/arm-estimator/arm-estimator/ace/Products/PostgreSQL/PostgreSQLFlexibleQueryFilter.cs:line 31
   at PostgreSQLFlexibleRetailQuery.GetQueryUrl(String location) in /home/runner/work/arm-estimator/arm-estimator/ace/Products/PostgreSQL/PostgreSQLFlexibleRetailQuery.cs:line 31
   at ACE.WhatIf.WhatIfProcessor.GetRetailAPIResponse[T](WhatIfChange change, CommonResourceIdentifier id, CancellationToken token) in /home/runner/work/arm-estimator/arm-estimator/ace/WhatIf/WhatIfProcessor.cs:line 635
   at ACE.WhatIf.WhatIfProcessor.Calculate[TQuery,TCalculation](WhatIfChange change, CommonResourceIdentifier id, CancellationToken token, Nullable`1 useFakeApiResponse) in /home/runner/work/arm-estimator/arm-estimator/ace/WhatIf/WhatIfProcessor.cs:line 552
   at ACE.WhatIf.WhatIfProcessor.Process(CancellationToken token) in /home/runner/work/arm-estimator/arm-estimator/ace/WhatIf/WhatIfProcessor.cs:line 419
   at ACE.Program.Estimate(FileInfo templateFile, String scopeId, String resourceGroupName, String location, EstimateOptions options, CommandType commandType) in /home/runner/work/arm-estimator/arm-estimator/ace/Program.cs:line 374
   at ACE.Program.<>c.<<Main>b__2_2>d.MoveNext() in /home/runner/work/arm-estimator/arm-estimator/ace/Program.cs:line 137
--- End of stack trace from previous location ---
   at System.CommandLine.Invocation.AnonymousCommandHandler.InvokeAsync(InvocationContext context)
   at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass17_0.<<UseParseErrorReporting>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass12_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseVersionOption>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass19_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__18_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<<UseParseDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__5_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass8_0.<<UseExceptionHandler>b__0>d.MoveNext()
kamil-mrzyglod commented 4 months ago

Hey @reijoh, big thanks for reporting the error. I'll take a look ASAP.

kamil-mrzyglod commented 4 months ago

@reijoh Could you please provide the template you used for your estimation? Specifically - SKU definition of PostgreSQL.

reijoh commented 4 months ago

@reijoh Could you please provide the template you used for your estimation? Specifically - SKU definition of PostgreSQL.

Thank you a lot... The code use modules and PostgreSQL is like this:

module postgre 'br/public:avm/res/db-for-postgre-sql/flexible-server:0.1.1' = {
  name: 'postgre'
  dependsOn: [kvPostgre]
  params: {
    name: GetNameByResourcename('postgreflexibleserver', environment, service_name, '', '')
    skuName: postgre_skuName
    tier: postgre_tier
    administratorLogin: 'vebtst'
    administratorLoginPassword: kvPostgre.getSecret('adminPassword100')
    backupRetentionDays: postgre_backupRetentionDays 
    geoRedundantBackup: postgre_geoRedundantBackup 
    createMode: 'Create'
    highAvailability: 'Disabled'
    passwordAuth: 'Enabled'
    privateDnsZoneArmResourceId: postgre_privateDnsZoneId
    storageSizeGB: postgre_storageSizeGB
    version: postgre_version
    configurations: [
      {
        name: 'azure.extensions'
        value: 'PGCRYPTO'
        source: 'user-override'
      }
    ]
    diagnosticSettings: [
      {
        workspaceResourceId: p_mgt_mon_workspaceResourceId
      }
    ]
  }
}

Please ask if you need more than the above.

kamil-mrzyglod commented 4 months ago

Thank you. Do you think you could send postgre_skuName and sku object defined inside that Bicep module?

reijoh commented 4 months ago

Thank you. Do you think you could send postgre_skuName and sku object defined inside that Bicep module?

Yes, the value of postgre_skuName is 'Standard_B1ms'.

The sku object look like this:

"sku": {
  "name": "Standard_B1ms",
  "tier": "Burstable"
}
github-actions[bot] commented 3 months ago

This issue is stale because it has been open 7 days with no activity. Remove stale label or comment or this will be closed in 5 days.

kamil-mrzyglod commented 3 months ago

@reijoh Sorry for keep you waiting but I just come back from holiday, will start working on that soon.

kamil-mrzyglod commented 2 months ago

Fix will be available in 1.5-beta2

kamil-mrzyglod commented 2 months ago

https://github.com/TheCloudTheory/arm-estimator/releases/tag/v1.5-beta2