dazzling-author-49810
01/26/2022, 8:56 PMechoing-dinner-19531
01/26/2022, 10:46 PMdazzling-author-49810
01/27/2022, 10:25 PMechoing-dinner-19531
01/27/2022, 10:36 PMget
method but it's documented as not for use in normal program flow but only for cloud functions that are embeded in your pulumi program:
/**
* Retrieves the underlying value of this dependency.
*
* This function is only callable in code that runs in the cloud post-deployment. At this
* point all Output values will be known and can be safely retrieved. During pulumi deployment
* or preview execution this must not be called (and will throw). This is because doing so
* would allow Output values to flow into Resources while losing the data that would allow
* the dependency graph to be changed.
*/
get(): T;
Chances are what ever you were hoping to do with the value inside the Output can be done another way. For example most resources will take Input<T>
as their input values and those can be made from plain values or Outputs.dazzling-author-49810
01/27/2022, 11:48 PMechoing-dinner-19531
01/27/2022, 11:53 PMnew Resource()
doesn't actually go off and make a new resource it just declares to the pulumi engine that the resource should exist. Pulumi then checks current state to decided if a create/update/replace/same is needed.dazzling-author-49810
01/28/2022, 1:31 PMechoing-dinner-19531
01/28/2022, 2:23 PMdazzling-author-49810
01/28/2022, 3:23 PMechoing-dinner-19531
01/28/2022, 3:31 PMdazzling-author-49810
01/28/2022, 5:07 PMimport * as pulumi from "@pulumi/pulumi";
import * as resources from "@pulumi/azure-native/resources";
export type *ResourceGroupResult* =
| *resources*.*GetResourceGroupResult*
| *resources*.*ResourceGroup*;
export var Current: *ResourceGroupResult*;
export function *set*(current: *ResourceGroupResult*) {
Current = current;
}
export const Config = new pulumi.*Config*("rg");
export const Name = Config.*require*("name");
export async function *ResourceGroup*(): *Promise*<*ResourceGroupResult*> {
const name = Name;
let rg: *ResourceGroupResult* | null = null;
try {
rg = await resources.*getResourceGroup*({
resourceGroupName: name,
});
} catch {}
if (!rg) {
rg = new resources.*ResourceGroup*(name);
}
return rg;
}*ResourceGroup*(name);
is directly used, it throwsresources.*getResourceGroup*
shouldn't work also!echoing-dinner-19531
01/28/2022, 6:49 PMdazzling-author-49810
01/29/2022, 1:53 PMrg = new resources.*ResourceGroup*(name);
don't workechoing-dinner-19531
01/29/2022, 1:59 PMnew ResourceGroup(name)
won't do what you want.dazzling-author-49810
01/30/2022, 9:54 AM