bored-table-20691
02/07/2022, 11:54 PMws, err := auto.NewLocalWorkspace(ctx, auto.Project(workspace.Project{
Name: tokens.PackageName("..."),
Runtime: workspace.NewProjectRuntimeInfo("go", nil),,
}))
Basically, how can I replace …
to specify the fully qualified name of my project? I tried myorg/myproject
but it doesn’t seem to take.prehistoric-kite-30979
02/14/2022, 8:14 PMawait (await LocalWorkspace.createOrSelectStack({ stackName: 'staging', workDir: infraDir })).getAllConfig()
Throws an error:
stderr: error: could not decrypt configuration value: [400] Message authentication failed
curved-quill-94238
02/14/2022, 10:43 PMerror configuring Terraform AWS Provider: AWS account ID not previously found and failed retrieving via all available methods. See <https://www.terraform.io/docs/providers/aws/index.html#skip_requesting_account_id> for workaround
, so I added the skipRequestingAccountId
param)
stack_config: Dict[str, Any] = {
"aws:region": ConfigValue(
"us-east-1"
)
}
stack_config["aws:skipRequestingAccountId"] = ConfigValue(True)
Then I create the stack, which seems to work fine.
project_settings = ProjectSettings(
name=project_name, runtime=project_runtime_info, backend=project_backend
)
stack_settings = StackSettings(
secrets_provider=secrets_provider,
encrypted_key=encrypted_key,
config=stack_config,
)
workspace_options = LocalWorkspaceOptions(
secrets_provider=secrets_provider, # Eli (2/11/22): since secrets_provider is already given in the ProjectSettings, I don't know if it's needed in both places or if just one spot would be better. Unclear at the moment
project_settings=project_settings,
stack_settings={stack_name: stack_settings},
)
print(f"Stack Config before initialization: {stack_config}") # allow-print
stack = create_or_select_stack(
stack_name,
project_name=project_name,
program=pulumi_program,
opts=workspace_options,
)
But then when I go to run preview
I get an error that seems to potentially indicate that this config is creating a new provider that isn't being passed into my inline program (maybe)
+ pulumi:pulumi:Stack: (create)
[urn=urn:pulumi:eli-test::my_project::pulumi:pulumi:Stack::my_project-eli-test]
Resources:
+ 1 to create
stderr: error: could not validate provider configuration: 1 error occurred:
* Attribute must be a single value, not a map
My inline program is just a simple creation of a bucket as I work to get the automation API framework up and running
def pulumi_program() -> None:
s3.Bucket("bucket")
Am I somehow not telling my inline program to use the provider config created by my stack? or am I just going about this the wrong way to configure the provider? I don't have any special custom provider configuration settings I need right now, I just have a role ARN that I need to assume in CI that has the permissions to deploy changes)sparse-intern-71089
02/15/2022, 11:16 AMbig-state-95297
02/16/2022, 9:22 AMaws:region
which is not explicitly read by any inline programs. I'm trying to pass-in some config values that need to be read using config.require(...)
method and when I run the automation api program using npm run start
, I see the error: Error: Program run without the Pulumi engine available; re-run using the pulumi CLI
. I see that the stack-trace points to the line where we try to do const config = new pulumi.Config()
. Is there another way we should be reading the config values when running output pulumi CLI?crooked-pillow-11944
02/20/2022, 9:46 PMdefault_tags
with pulumi automation api?bumpy-agent-19616
02/21/2022, 4:21 PMconst projectName = "pulumi_over_http";
const createPulumiProgram = (content: string) => async () => {
// Create a bucket and expose a website index document
console.log("Resource group creation starts...")
const resourceGroup = new azure.core.ResourceGroup('rg');
console.log("Resource group creation ends...")
console.log("Storage account creation starts...")
const storage = new azure.storage.Account("storageaccount", {
accountKind: 'StorageV2',
accountReplicationType: 'LRS',
accountTier: 'Standard',
allowBlobPublicAccess: false,
location: 'WestEurope',
name: "storageaccount",
resourceGroupName: resourceGroup.name,
});
console.log("Storage account creation ends...")
console.log("Storage container creation starts...");
const container = new azure.storage.Container(
"storagecontainer",
{
containerAccessType: 'blob',
name: "storagecontainer",
storageAccountName: storage.name,
});
console.log("Storage container creation ends...");
// Upload the files
["index.html", "404.html"].map(name =>
new azure.storage.Blob(name, {
contentType: 'text/html',
// source: `./static/${page.name}`,
name,
storageAccountName: storage.name,
storageContainerName: container.name,
type: 'Block',
}),
);
};
const buildBaseRequestCopy = (
baseRequest: BaseRequest,
) => ({
...baseRequest,
purpose: 'pul',
});
const init = async (
kvName: string,
baseRequest: BaseRequest,
stackName: string
) => {
// await initBasicLocalWorkspaceConfig(kvName, baseRequest.environment, stackName);
// await initAtlasLocalWorkspaceConfig(kvName, baseRequest.environment, stackName);
// case AzureEnvVar.AZURE_CLIENT_ID:
process.env.AZURE_CLIENT_ID = 'XXXXXXXXXXXX';
process.env.AZURE_CLIENT_SECRET = 'XXXXXXXXXXXX'
process.env.AZURE_TENANT_ID = 'XXXXXXXXXXXX'
process.env.AZURE_CLIENT_OBJECT_ID = 'XXXXXXXXXXXX'
}
const baseRequest: BaseRequest = {
application: 'atl',
countryCode: '3se',
domain: 'cld',
environment: 'dev',
project: '',
team: '',
}
const request: AtlasRequest = {
...baseRequest,
};
const baseRequestCopy: BaseRequest = buildBaseRequestCopy(
baseRequest,
);
const stackName = 'atl-cld-dev-3se';
const kvName = 'hi3gkvpulatlclddev3se';
const strName = 'hi3gstgpulatlclddev3se'
// creates new sites
const createHandler: express.RequestHandler = async (req, res) => {
const content = req.body.content as string;
await init(kvName, baseRequestCopy, stackName);
try {
// create a new stack
const stack = await LocalWorkspace.createStack({
// generate our pulumi program on the fly from the POST body
program: createPulumiProgram(content),
projectName,
stackName,
},
setLocalWorkspaceOptions(
projectName,
stackName,
kvName,
strName,
),
);
await stack.setConfig("azure:region", { value: "west-europe" });
// deploy the stack, tailing the logs to console
const upRes = await stack.up({ onOutput: <http://console.info|console.info> });
res.json({ id: stackName, url: upRes.outputs.websiteUrl.value });
} catch (e) {
if (e instanceof StackAlreadyExistsError) {
res.status(409).send(`stack "${stackName}" already exists`);
} else {
res.status(500).send(e);
}
}
};
// updates the content for an existing site
const updateHandler: express.RequestHandler = async (req, res) => {
const stackName = req.params.id;
const content = req.body.content as string;
try {
await init(kvName, baseRequestCopy, stackName);
// create a new stack
const stack = await LocalWorkspace.selectStack({
// generate our pulumi program on the fly from the POST body
program: createPulumiProgram(content),
projectName,
stackName,
},
setLocalWorkspaceOptions(
projectName,
stackName,
kvName,
strName,
),
);
await stack.setConfig("azure:region", { value: "west-europe" });
// deploy the stack, tailing the logs to console
const upRes = await stack.up({ onOutput: <http://console.info|console.info> });
res.json({ id: stackName, url: upRes.outputs.websiteUrl.value });
} catch (e) {
if (e instanceof StackNotFoundError) {
res.status(404).send(`stack "${stackName}" does not exist`);
} else if (e instanceof ConcurrentUpdateError) {
res.status(409).send(`stack "${stackName}" already has update in progress`)
} else {
res.status(500).send(e);
}
}
};
const ensurePlugins = async () => {
const ws = await LocalWorkspace.create({});
await ws.installPlugin("azure", "v4.6.0");
};
// install necessary plugins once upon boot
ensurePlugins();
// configure express
const app = express();
app.use(express.json());
// setup our RESTful routes for our Site resource
<http://app.post|app.post>("/atlas", createHandler);
app.put("/atlas/:id", updateHandler);
// start our http server
// start our http server
app.listen(1337, () => <http://console.info|console.info>("server running on :1337"));
most-lighter-95902
02/21/2022, 5:53 PMpending_operations
which is preventing me to re-run this. I know that I typically have to import/export the state to remove it manually when I’m working locally but how do I handle this as part of the Automation API?most-lighter-95902
02/21/2022, 10:38 PMcurved-quill-94238
02/22/2022, 3:39 PMconfig
from inside an inline program (Python flavor)? I feel like there must be a way to do this, but I haven't found it in the docs, examples, or Stack Overflow
I tried pulumi.get_stack()
to see if I could then run get_config
, but apparently get_stack
returns just the str
of the stack name, not the actual Stack
object itselfcrooked-pillow-11944
02/23/2022, 7:04 PMhigh-leather-15669
02/24/2022, 8:07 AMautomation API
using a Azure Storage Account. I can do this over pulumi CLI, but haven't found any docs/examples to do this over the Automation API, could someone be so kind to point it for me? Thank you!miniature-leather-70472
03/01/2022, 2:22 PMprehistoric-kite-30979
03/01/2022, 3:40 PMconst opts = { ...options.Azure('azure'), region: stack.region, resourceGroupName }
options.Azure is located in a separate TS package and does the following:
export function Azure(
name: string,
opts?: CustomResourceOptions,
providerOptions?: ProviderOptions,
): AzureOptions {
const subscriptionId = cfg.require('subscriptionId')
const provider = new azure.Provider(
name,
{
tenantId,
subscriptionId,
clientId: cfg.require('clientId'),
clientSecret: cfg.requireSecret('clientSecret'),
},
providerOptions,
)
return {
subscriptionId,
provider,
...opts,
}
}
I suspect it has something to do with it being in a separate package… any ideas?fast-dinner-32080
03/02/2022, 9:09 PMfast-dinner-32080
03/02/2022, 9:16 PMfast-dinner-32080
03/03/2022, 4:25 PMmost-lighter-95902
03/04/2022, 3:37 AMmost-lighter-95902
03/04/2022, 3:37 AMerror: no resource plugin 'aws-v4.23.0' found in the workspace or on your $PATH, install the plugin using `pulumi plugin install resource aws v4.23.0`
most-lighter-95902
03/04/2022, 3:37 AMmost-lighter-95902
03/04/2022, 3:37 AMtry {
const stack = await LocalWorkspace.createOrSelectStack({
stackName: `${organization}/${stackName}`,
projectName: project,
program,
})
await stack.workspace.installPlugin('aws', 'v4.36.0')
await stack.workspace.installPlugin('kubernetes', 'v3.15.0')
await stack.setAllConfig({ ...configMap })
const upRes = await stack.up({ onOutput: <http://console.info|console.info> })
return upRes
} catch (err) {
console.log('err in createOrUpdateStack', err)
throw new Error('err in createOrUpdateStack')
}`
most-lighter-95902
03/04/2022, 3:38 AMv4.23.0
but that didn’t work eithermost-lighter-95902
03/04/2022, 3:38 AMmost-lighter-95902
03/06/2022, 4:35 AM'error: PULUMI_ACCESS_TOKEN must be set for login during non-interactive CLI sessions\n'
most-lighter-95902
03/06/2022, 4:36 AMconst stack = await LocalWorkspace.selectStack({
stackName: `${organization}/${stackName}`,
projectName: project,
program: async () => { }, // don't need a program just to get outputs
})
await stack.setAllConfig({ 'PULUMI_ACCESS_TOKEN': 'xxx' })
const outputsRes = await stack.outputs()
most-lighter-95902
03/06/2022, 4:59 AMmost-lighter-95902
03/11/2022, 3:01 AMmost-lighter-95902
03/11/2022, 3:01 AMmost-lighter-95902
03/11/2022, 3:01 AMName: DeveloperRole
Labels: <http://app.kubernetes.io/managed-by=pulumi|app.kubernetes.io/managed-by=pulumi>
Annotations: <none>
PolicyRule:
Resources Non-Resource URLs Resource Names Verbs
--------- ----------------- -------------- -----
* [] [] [*]
*.apps [] [] [*]
*.autoscaling [] [] [*]
*.batch [] [] [*]
*.extensions [] [] [*]
*.policy [] [] [*]
*.<http://rbac.authorization.k8s.io|rbac.authorization.k8s.io> [] [] [*]
most-lighter-95902
03/11/2022, 3:02 AMjobs-flow
namespace this way:most-lighter-95902
03/11/2022, 3:02 AMjobs-flow
namespace this way: