ResourceModules icon indicating copy to clipboard operation
ResourceModules copied to clipboard

[Bug Report]: cdn/profile/endpoint - dependsOn missing for endpoint_origins on endpoint

Open dibcar opened this issue 2 years ago • 2 comments

Describe the bug

While deploying a cdn profile with endpoint, both the origin and endpoint are deployed at the same time and cause the endpoint_origins to failed with a not found error on the endpoint. I fixed the issus on my local repository with dependsOn: [ endpoint ] on endpoint_origin in the module cdn/profile/endpoint/main.bicep

To reproduce

Create a cdn profile with an endpoint

Code snippet

var location = 'CanadaCentral'
var cdneName  = 'endpointname01' 
var cdnpName = 'profilename01'
var url = '[teststorageaccount].blob.core.windows.net'

module profile 'modules/cdn/profile/main.bicep' = {  
  name: '${uniqueString(deployment().name, location)}-test-cdnpafd'
  params: {
    name: cdnpName
    sku: 'Standard_Microsoft'
    endpointProperties: {
      name: cdneName
      location: location
      isCompressionEnabled: false
      isHttpAllowed: false
      isHttpsAllowed: true
      origins: [
        {
          name: 'cdneporitest01'
          properties: {
            hostName:  url
            httpPort: 80
            httpsPort: 443
            originHostHeader: url
            enabled: true
            weight: 1000
            priority: 1  
          }
        }  
      ]
    }
    location: 'global'
  }
}

Relevant log output

details":[{"code":"NotFound","message":"The resource cannot be found."},{"code":"NotFound","message":"The requested resource was not found."

dibcar avatar Jan 19 '24 16:01 dibcar

Hey @dibcar thank you for opening this issue (as sorry for the late response). As the module was not migrated to AVM yet, I'll go ahead an implement it on the CARML-side. Thank you :)

AlexanderSehr avatar Feb 01 '24 08:02 AlexanderSehr

Alright, the PR is up and linked to this issue. I solved it slightly differently as I noticed the implementation was not consistent with our other modules in that it should have referenced the endpoint name like endpointName: endpoint.name not only being less dependend on the template input, but also introducing an implicit dependency.

AlexanderSehr avatar Feb 01 '24 08:02 AlexanderSehr