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

[codegen/dotnet] - Dynamic provider config getters #7549

Merged
merged 4 commits into from
Jul 20, 2021

Conversation

komalali
Copy link
Member

@komalali komalali commented Jul 16, 2021

Description

Fixes #5582

Since this is incredibly difficult to write automated tests for, I confirmed that this works as expected locally by running the following program:

using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Pulumi.Automation;

namespace InlineProgram
{
    class Program
    {
        static async Task Main(string[] args)
        {
            // define our pulumi program "inline"
            var program = PulumiFn.Create(() =>
            {
                // export the website url
                return new Dictionary<string, object?>
                {
                    ["currentRegion"] = Pulumi.Aws.Config.Region,
                };
            });

            var projectName = "dynamic_config_test_dotnet";
            var stackName = "dev";

            var stackArgs = new InlineProgramArgs(projectName, stackName, program);
            var stack = await LocalWorkspace.CreateOrSelectStackAsync(stackArgs);

            await stack.Workspace.InstallPluginAsync("aws", "v4.11.0");

            await stack.SetConfigAsync("aws:region", new ConfigValue("us-west-1"));
            var result = await stack.UpAsync();
            Console.WriteLine(result.Outputs["currentRegion"].Value as String == "us-west-1" ? "test passed" : "fail");

            await stack.SetConfigAsync("aws:region", new ConfigValue("us-east-1"));
            result = await stack.UpAsync();
            Console.WriteLine(result.Outputs["currentRegion"].Value as String == "us-east-1" ? "test passed" : "fail");

            await stack.DestroyAsync();
        }
    }
}

Checklist

  • I have added (codegen) tests that prove my fix is effective or that my feature works
  • Yes, there are changes in this PR that warrants bumping the Pulumi Service API version

@github-actions
Copy link

Diff for pulumi-random with merge commit 6bca56a

@github-actions
Copy link

Diff for pulumi-random with merge commit 2612ac0

@github-actions
Copy link

Diff for pulumi-random with merge commit 3b8f59b

@github-actions
Copy link

Diff for pulumi-azuread with merge commit 3b8f59b

@github-actions
Copy link

Diff for pulumi-gcp with merge commit 3b8f59b

@github-actions
Copy link

Diff for pulumi-azure with merge commit 3b8f59b

@github-actions
Copy link

Diff for pulumi-aws with merge commit 3b8f59b

@komalali komalali marked this pull request as ready for review July 16, 2021 16:31
@github-actions
Copy link

Diff for pulumi-random with merge commit 7aa50ec

@github-actions
Copy link

Diff for pulumi-azuread with merge commit 7aa50ec

@github-actions
Copy link

Diff for pulumi-gcp with merge commit 7aa50ec

@github-actions
Copy link

Diff for pulumi-aws with merge commit 7aa50ec

@github-actions
Copy link

Diff for pulumi-azure with merge commit 7aa50ec

@github-actions
Copy link

Diff for pulumi-random with merge commit 1e68b91

@github-actions
Copy link

Diff for pulumi-azuread with merge commit 1e68b91

@github-actions
Copy link

Diff for pulumi-gcp with merge commit 1e68b91

Copy link
Member

@justinvp justinvp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@github-actions
Copy link

Diff for pulumi-azure with merge commit 1e68b91

@github-actions
Copy link

Diff for pulumi-aws with merge commit 1e68b91

@github-actions
Copy link

Diff for pulumi-azure-native with merge commit 1e68b91

@komalali komalali merged commit 5de0940 into master Jul 20, 2021
@pulumi-bot pulumi-bot deleted the komalali/dotnet-config branch July 20, 2021 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants