question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

FunctionsConfig not respecting ResourceRef/ExternalKind

See original GitHub issue

We have the following type extension to the functions builder:

type FunctionsBuilder with
    [<CustomOperation("link_to_unmanaged_storage_account")>]
    member this.LinkToUnmanagedStorage (state:Farmer.Builders.Functions.FunctionsConfig, storageAccountId) =
       {state with StorageAccount =  External ( Unmanaged ( storageAccountId )) }

However, owing to the way FunctionsConfig sets the dependencies, the external-ness of this is ignored:

member this.StorageAccountName : Storage.StorageAccountName = this.StorageAccount.resourceId(this).Name |> Storage.StorageAccountName.Create |> Result.get
// ...
              Dependencies = Set [
                yield! this.Dependencies
                match this.AppInsights with
                | Some (DependableResource this resourceId) -> resourceId
                | _ -> ()
                for setting in this.Settings do
                    match setting.Value with
                    | ExpressionSetting e -> yield! Option.toList e.Owner
                    | ParameterSetting _ | LiteralSetting _ -> ()
                match this.ServicePlan with
                | DependableResource this resourceId -> resourceId
                | _ -> ()

                storageAccounts.resourceId this.StorageAccountName.ResourceName
              ]

Is it possible to

  1. Respect the external-ness of ResourceRef
  2. Add unmanaged operator overloads to the Functions Builder to give parity with the WebApp builder?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
TheRSPcommented, Nov 27, 2020

Thank you for the fix. I’ve passed on your warnings about sharing storage accounts to my colleagues working with the functions I think we’ll be adjusting our plans based on this. Thank you.

0reactions
isaacabrahamcommented, Nov 27, 2020

@TheRSP this will be pushed out as part of the next 1.3 release. Just note: don’t have two azure functions instances that share the same storage account as the dashboard (or maybe even the leases) probably won’t work. That’s why have isolated storage accounts for each functions instance is IMHO better practice.

Read more comments on GitHub >

github_iconTop Results From Across the Web

cannot use `external` in resourceRef for IAMPolicyMember
Describe the bug Using external for resourceRef in IAMPolicyMember fails schema validation without kind attribute.
Read more >
Unable to deploy IAMPolicyMember on GCP due ...
I am trying to deploy a role for one of my service accounts via IAMPolicyMember all whilst avoiding the use of the spec.resourceRef.external...
Read more >
Creating resource references - Config Connector
Config Connector can reference resources that it does not manage. These are known as External References. For example, the ComputeURLMap below references a ......
Read more >
Trying to build a Firebase functions project while importing ...
A way around it, that is not too hacky, is to declare your shared type as a namespace and import them with a...
Read more >
How to setup StorageNotification on GKE with Config ...
I was having the same issue and managed to resolve it by changing the topicRef.name to topicRef.external with the fully qualified topic name ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found