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

Improve the provider initialization #322

Merged
merged 3 commits into from
Sep 27, 2017
Merged

Improve the provider initialization #322

merged 3 commits into from
Sep 27, 2017

Commits on Sep 27, 2017

  1. Remove dead code (unused struct field)

    Sander van Harmelen committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    b2d0ee8 View commit details
    Browse the repository at this point in the history
  2. Do not use sync.Once for a function that is called once anyway

    The `registerAzureResourceProvidersWithSubscription` function is being called exactly once while executing the `providerConfigure` func.
    
    In turn the `providerConfigure` func is also called exactly once while executing a Terraform command (e.g. plan, apply).
    
    So when executing TF commands from the commandline there is absolutely no added value for using a `sync.Once` as the registration call is only being executed once anyway.
    
    If on the other hand you use the TF packages in a long running microservice process (like we do), having this `sync.Once` actually causes issues when using multiple different (and regularly changing) provider credentials (as only the first used credentials will register the providers).
    
    So since it adds nothing, but does cause issues in specific setups, I refactored the provider to not use the `sync.Once` anymore.
    Sander van Harmelen committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    845e661 View commit details
    Browse the repository at this point in the history
  3. Add an option to skip the credential validation

    Nice if you make multiple validation or plan calls in a row from a microservice, before actually making the apply call.
    
    With this option we can skip this expensive HTTP call as we already know the credentials are valid.
    Sander van Harmelen committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    21ab99a View commit details
    Browse the repository at this point in the history