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

Error on deployment "The resource type '/' does not support diagnostic settings." when deploying a diagnosticSettings resource #14292

Closed
TWolversonReply opened this issue Jun 10, 2024 · 2 comments
Labels
Needs: Author Feedback Awaiting feedback from the author of the issue Status: No Recent Activity

Comments

@TWolversonReply
Copy link

TWolversonReply commented Jun 10, 2024

Bicep version
run bicep --version via the Bicep CLI, az bicep version via the AZ CLI or via VS code by navigating to the extensions tab and searching for Bicep
0.26.170
(also tried with 0.28.10, no difference)

Describe the bug

Given the relevant template modules:

// Create QC Logic App Standard
module stdLApp './core/host/standard-logic-app.bicep' = {
  name: 'stdLApp'
  scope: landingZoneResourceGroup
  params: {
    name: namingPatternGenerator(abbrs.logicWorkflows, location, envName, resourceNameWorkload, resourceNameDisambiguator)
    location: location
    appServicePlanId: lzAppServicePlan.id
    storageAccountName: stdLAppStorage.outputs.name
    tags: union(tags, { 'azd-service-name': 'qcStdLApp' })
    subnetId: subnetStdLApp.id
    keyVaultName: kvName
    applicationInsightsName: appInsightsName
    appSettings: {
     <settings>
    }
  }
}

module qcDiagnosticSetting 'core/monitor/diagnostic-setting.bicep' = {
  name: 'qcDiagnosticSetting'
  scope: landingZoneResourceGroup
  dependsOn: [stdLApp]
  params: {
    stdLAppName: namingPatternGenerator(abbrs.logicWorkflows, location, envName, resourceNameWorkload, resourceNameDisambiguator)
    logAnalyticsWorkspaceId: resourceId(subscription().subscriptionId, landingZoneResourceGroupName, 'Microsoft.OperationalInsights/Workspaces', lzLogAnalytics.name)
    logAnalyticsAllMetricsRetentionDays: logAnalyticsAllMetricsRetentionDays
    logAnalyticsWorkflowRuntimeRetentionDays: logAnalyticsWorkflowRuntimeRetentionDays
  }
}

Deploying with azd returns an error message:

ResourceTypeNotSupported: The resource type '/' does not support diagnostic settings.

We have updated recently to define the resource names in a user-defined function called namingPatternGenerator. Prior to this change, the deployment of the diagnostic setting worked perfectly. I have also amended to directly apply the expected logic app standard name as a string passed to stdLAppName, which would reverse any deploy-time nondeterminacy which might be the cause - this made no difference.

To Reproduce

Deploy a main.bicep containing these modules using azd provision

Additional context

The error message given is wrong, as we didn't specify a resource type of '/'. Whatever the error actually is, Bicep should say so.

I've checked https://github.com/Azure/bicep/issues/12959 where the author remarks that they can't prove that an arbitrary string is a resource identifier - I don't believe this is the case here as the diagnostic settings module uses:

resource stdLApp 'Microsoft.Web/sites@2021-03-01' existing = {
  name: stdLAppName
}

This can be proved a valid resource identifier, and it is being passed a string I know refers to a Logic App that exists.

@anthony-c-martin
Copy link
Member

@TWolversonReply are you able to share the .bicep files for the 2 modules referenced in your sample?

Copy link
Contributor

Hi @TWolversonReply, this issue has been marked as stale because it was labeled as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within 3 days of this comment. Thanks for contributing to bicep! 😄 🦾

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Author Feedback Awaiting feedback from the author of the issue Status: No Recent Activity
Projects
Archived in project
Development

No branches or pull requests

2 participants