Skip to content

Commit

Permalink
Fix CreateRegisterResourceRequest
Browse files Browse the repository at this point in the history
  • Loading branch information
Frassle committed Nov 4, 2022
1 parent f36b43d commit 0d634ac
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions sdk/Pulumi/Deployment/Deployment_RegisterResource.cs
Expand Up @@ -25,7 +25,7 @@ public partial class Deployment
throw new Exception("The Pulumi CLI does not support the DeletedWith option. Please update the Pulumi CLI.");
}

var request = CreateRegisterResourceRequest(type, name, custom, remote, options);
var request = await CreateRegisterResourceRequest(type, name, custom, remote, options);

Log.Debug($"Preparing resource: t={type}, name={name}, custom={custom}, remote={remote}");
var prepareResult = await PrepareResourceAsync(label, resource, custom, remote, args, options).ConfigureAwait(false);
Expand Down Expand Up @@ -68,11 +68,15 @@ private static void PopulateRequest(RegisterResourceRequest request, PrepareResu
}
}

private static RegisterResourceRequest CreateRegisterResourceRequest(
private async static Task<RegisterResourceRequest> CreateRegisterResourceRequest(
string type, string name, bool custom, bool remote, ResourceOptions options)
{
var customOpts = options as CustomResourceOptions;
var deleteBeforeReplace = customOpts?.DeleteBeforeReplace;
var deletedWith = "";
if (options.DeletedWith != null) {
deletedWith = await options.DeletedWith.Urn.GetValueAsync("").ConfigureAwait(false);
}

var request = new RegisterResourceRequest
{
Expand All @@ -95,7 +99,7 @@ private static void PopulateRequest(RegisterResourceRequest request, PrepareResu
},
Remote = remote,
RetainOnDelete = options.RetainOnDelete ?? false,
DeletedWith = options.DeletedWith ?? false,
DeletedWith = deletedWith,
};

if (customOpts != null)
Expand Down

0 comments on commit 0d634ac

Please sign in to comment.