bored-barista-23480
01/25/2022, 12:42 PMTypeError: 'ResourceTransformationArgs' object is not subscriptable
. I could not find any mention of this error specific to this class. I also could't find any helpful examples of how to use transformations other than the mentioned one. Anyone have a clue why it does not work and how to fix it?prehistoric-activity-61023
01/25/2022, 1:40 PMobj.a
, you try to use obj["a"]
import pulumi
import pulumi_kubernetes as k8s
# Create resources from standard Kubernetes guestbook YAML example.
def make_frontend_public(obj):
if obj['kind'] == "Service" and obj['metadata']['name'] == "frontend":
obj['spec']['type'] = "LoadBalancer"
guestbook = k8s.yaml.ConfigFile('guestbook', 'guestbook-all-in-one.yaml', transformations=[make_frontend_public])
(it’s copy’n’paste example from the docs)python --version
• pulumi cli version
pulumi version
• python modules
(within venv) pip freeze | grep pulumi
You can also try to upgrade the dependencies first and see if that resolves the issue.bored-barista-23480
01/25/2022, 2:31 PM3.8.10
Pulumi: 3.22.1
Modules:
pulumi==3.22.1
pulumi-aws==4.35.0
pulumi-eks==0.36.0
pulumi-kubernetes==3.14.1
Obviously I am trying to use the subscript functionality. But that's how it is used in the example as well. I think I even used it like that before. That's why I'm irritated.prehistoric-activity-61023
01/25/2022, 3:00 PMtransformations
as ConfigMap
field and not using generic resource transformations available through opts
and `pulumi.ResourceOptions`:
WORKING EXAMPLE
guestbook = k8s.yaml.ConfigFile(
'guestbook',
'guestbook-all-in-one.yaml',
transformations=[make_frontend_public],
)
ERROR
guestbook = k8s.yaml.ConfigFile(
'guestbook',
'guestbook-all-in-one.yaml',
opts=pulumi.ResourceOptions(transformations=[make_frontend_public]),
)
bored-barista-23480
01/25/2022, 3:23 PM