echoing-dawn-86996
01/05/2021, 2:51 PMMetricBucketOptionsArgs
MetricMetricDescriptorArgs
MetricMetricDescriptorLabelArgs
average-school-38756
01/09/2021, 9:41 PM_import
option is working well. One case which is not working is trying to use an existing AWS Lambda function. There is some difference detected in the code
property:
+ pulumi:pulumi:Stack hello-dev create 1 error
...
= ├─ aws:lambda:Function exampleLambda import [diff: +code]; 1 warning
...
aws:lambda:Function (exampleLambda):
warning: inputs to import do not match the existing resource; importing this resource will fail
Original code looks like this:
lambda_.Function("exampleLambda",
role=lambda_role.arn,
runtime="python3.7",
handler='hello.handler',
code=pulumi.AssetArchive({
'.': pulumi.FileArchive('./hello')
})
)
State looks like this:
{
"4dabf18193072939515e22adb298388d": "0def7320c3a5731c473e5ecbe6d01bc7",
"assets": {
".": {
"4dabf18193072939515e22adb298388d": "0def7320c3a5731c473e5ecbe6d01bc7",
"hash": "935cf7f6edab4c54246b65708d75c720b7e47142e4c0d70ed8e7803ec63b4883",
"path": "./hello"
}
},
"hash": "935cf7f6edab4c54246b65708d75c720b7e47142e4c0d70ed8e7803ec63b4883"
}
How can i detect and address the difference detected when pulumi up
is run?
$ pulumi preview --diff
...
warning: inputs to import do not match the existing resource; importing this resource will fail
= aws:lambda/function:Function: (import)
[id=exampleLambda-2775aa5]
[urn=urn:pulumi:dev::hello::aws:lambda/function:Function::exampleLambda]
[provider=urn:pulumi:dev::hello::pulumi:providers:aws::default_3_20_0::04da6b54-80e4-46f7-96ec-b56ff0331ba9]
+ code: archive(assets:935cf7f) {
+ ".": archive(assets:935cf7f) {
}
}
echoing-dawn-86996
01/10/2021, 12:51 PMdelete_before_replace=True
is simply not working.
Here is how I do it:
compute.Instance(
f"{name}-{zone}",
# More instance config here
opts=ResourceOptions(delete_before_replace=True)
)
However, pulumi simply ignores it. Each time the resource changes (the name changes), it first creates the new resource, and then deletes the old one.
What am I missing here?flat-appointment-64705
01/12/2021, 11:17 AMflat-appointment-64705
01/12/2021, 11:18 AMjolly-camera-35709
01/14/2021, 6:55 AMjolly-camera-35709
01/14/2021, 6:55 AMdb_server_fqdn = db_stack.get_output("db_server_fqdn")
db_server_fqdn_value = db_server_fqdn.apply(lambda db_server_fqdn: db_server_fqdn)
jolly-camera-35709
01/14/2021, 6:56 AMbrief-wolf-79064
01/15/2021, 12:19 AMcluster = eks.Cluster('my-cluster')
namespace = k8s.core.v1.Namespace(
'foo',
metadata=dict(name='foo'),
opts=pulumi.ResourceOptions(provider=cluster.provider)
)
brief-wolf-79064
01/15/2021, 12:20 AMpulumi-up
I get an exception that AttributeError: 'str' object has no attribute 'urn'
brief-wolf-79064
01/15/2021, 12:21 AMcluster.provider.apply(print)
agreeable-notebook-88887
01/15/2021, 6:17 PMfuture-hydrogen-91224
01/15/2021, 8:37 PMfuture-hydrogen-91224
01/15/2021, 8:42 PMbrash-noon-26580
01/15/2021, 9:47 PMpulumi.config.ConfigMissingError: Missing required configuration variable 'project:BILLING_ACCOUNT'
please set a value using the command `pulumi config set project:BILLING_ACCOUNT <value>`
Could someone point me in the correct direction on the best way to handle this?bland-lamp-16797
01/20/2021, 5:07 PMservice_object = pulumi_kubernetes.core.v1.Service.get('whatever')
returns almost empty Service?
All the sudden, service_object.status
is None and I can't figure out why?helpful-rain-41425
01/21/2021, 2:32 AMimport pulumi
from pulumi_azure_nextgen.containerinstance import latest as containerinstance
from pulumi_azure_nextgen.resources import latest as resources
from pulumi_azure_nextgen.storage import latest as storage
app_name = "tigstack"
resource_group = resources.ResourceGroup("resourceGroup",
resource_group_name="rg-syd-dev-{0}".format(app_name),
location="australiaeast")
account = storage.StorageAccount("storageAccount",
account_name="grafana",
resource_group_name=resource_group.name,
location=resource_group.location,
sku=storage.SkuArgs(
name="Standard_LRS"
),
kind="StorageV2")
file_share = storage.FileShare("smbFileShare",
account_name=account.name,
enabled_protocols="SMB",
resource_group_name=resource_group.name,
share_name="tigstack")
storageAccountKeys = pulumi.Output.all(resource_group.name, account.name).apply(
lambda args: storage.list_storage_account_keys(args))
I came up with that where I want to refer to storageAccountKeys later in the code but it doesn't seem to work - i think I don't understand the output.all that wellmillions-toddler-84466
01/25/2021, 6:11 PMaverage-school-38756
01/26/2021, 3:17 AMpulumi_docker.Image
doesn't have an "id" value anymore, and using the full image_name
value for pulumi.ResourceOptions(import_="")
still results in a "create" rather than "import" for pulumi up
chilly-receptionist-94436
01/26/2021, 8:38 PMstocky-hair-65085
01/27/2021, 1:04 PMstocky-hair-65085
01/28/2021, 2:33 PMOutput.all()
• In a python lambda create a dict with the needed structure. and dump it using yaml.dump
.
• This string is passed to Kubernetes Secret which is mounted into the needed pod.
I'm not fully happy with this approach because the numbered arguments in the lambda of Output.all()
are error-prone when you have more than a few resources.sparse-state-34229
01/31/2021, 8:49 AMcreate_before_destroy
. Can't find anything on the site or slack searchelegant-carpet-82808
02/03/2021, 1:48 AMmysterious-area-77666
02/09/2021, 8:16 PMpkiSecret
?red-match-15116
02/09/2021, 8:25 PMquaint-tailor-52411
02/10/2021, 9:18 PMpulumi up
was expecting it to relaunch a vm. but the state diff doesn’t seem to have detected itquaint-tailor-52411
02/10/2021, 9:21 PMrefresh
— is this expected?incalculable-dream-27508
02/11/2021, 3:23 PMsec_rule_api = openstack.networking.SecGroupRule(
"name",
__opts__=pulumi.ResourceOptions(provider=REGIONS[dc]),
delete_before_replace=True)
and with the last line added now I'm getting
error: Program failed with an unhandled exception:
error: Traceback (most recent call last):
File "/home/user/.pulumi/bin/pulumi-language-python-exec", line 85, in <module>
loop.run_until_complete(coro)
File "/usr/lib64/python3.9/asyncio/base_events.py", line 642, in run_until_complete
return future.result()
File "/home/user/.local/share/virtualenvs/pulumi-openotp-xju7YdsB/lib/python3.9/site-packages/pulumi/runtime/stack.py", line 83, in run_in_stack
await run_pulumi_func(lambda: Stack(func))
File "/home/user/.local/share/virtualenvs/pulumi-openotp-xju7YdsB/lib/python3.9/site-packages/pulumi/runtime/stack.py", line 35, in run_pulumi_func
func()
File "/home/user/.local/share/virtualenvs/pulumi-openotp-xju7YdsB/lib/python3.9/site-packages/pulumi/runtime/stack.py", line 83, in <lambda>
await run_pulumi_func(lambda: Stack(func))
File "/home/user/.local/share/virtualenvs/pulumi-openotp-xju7YdsB/lib/python3.9/site-packages/pulumi/runtime/stack.py", line 106, in __init__
func()
File "/home/user/.pulumi/bin/pulumi-language-python-exec", line 84, in <lambda>
coro = pulumi.runtime.run_in_stack(lambda: runpy.run_path(args.PROGRAM, run_name='__main__'))
File "/usr/lib64/python3.9/runpy.py", line 285, in run_path
return _run_code(code, mod_globals, init_globals,
File "/usr/lib64/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "./__main__.py", line 190, in <module>
sec_rule_api = openstack.networking.SecGroupRule(
TypeError: __init__() got an unexpected keyword argument 'delete_before_replace'
error: an unhandled error occurred: Program exited with non-zero exit code: 1
According to my reading of https://www.pulumi.com/docs/reference/pkg/python/pulumi/#pulumi.ResourceOptions this should work, right?incalculable-dream-27508
02/11/2021, 3:40 PMsec_rule_api = openstack.networking.SecGroupRule(
"name",
__opts__=pulumi.ResourceOptions(provider=REGIONS[dc],
delete_before_replace=True))
incalculable-dream-27508
02/11/2021, 3:40 PMsec_rule_api = openstack.networking.SecGroupRule(
"name",
__opts__=pulumi.ResourceOptions(provider=REGIONS[dc],
delete_before_replace=True))