I have a GCE static IP I'm trying to define like this:
resources.gceStaticIPs.<name> = credentials // {
name = "<name>";
ipAddress = "<ip address>";
region = "<region>";
};
Without the region attribute, this passes validation. With region included I get the following error:
Traceback (most recent call last):
File "/nix/store/55bgjfnjsgaqwfiy5rzfgcklv6b3m2fp-python3.8-nixops-2.0.0/bin/.nixops-wrapped", line 9, in <module>
sys.exit(main())
File "/nix/store/1z9i3wk9a9z8cldgh28khkwfpk938hrl-python3-3.8.9-env/lib/python3.8/site-packages/nixops/__main__.py", line 710, in main
args.op(args)
File "/nix/store/1z9i3wk9a9z8cldgh28khkwfpk938hrl-python3-3.8.9-env/lib/python3.8/site-packages/nixops/script_defs.py", line 338, in op_info
do_eval(depl)
File "/nix/store/1z9i3wk9a9z8cldgh28khkwfpk938hrl-python3-3.8.9-env/lib/python3.8/site-packages/nixops/script_defs.py", line 246, in do_eval
depl.evaluate()
File "/nix/store/1z9i3wk9a9z8cldgh28khkwfpk938hrl-python3-3.8.9-env/lib/python3.8/site-packages/nixops/deployment.py", line 571, in evaluate
defn = _create_definition(
File "/nix/store/1z9i3wk9a9z8cldgh28khkwfpk938hrl-python3-3.8.9-env/lib/python3.8/site-packages/nixops/deployment.py", line 1797, in _create_definition
return cls(name, nixops.resources.ResourceEval(config))
File "/nix/store/1z9i3wk9a9z8cldgh28khkwfpk938hrl-python3-3.8.9-env/lib/python3.8/site-packages/nixops_gcp/resources/gce_static_ip.py", line 30, in __init__
self.config.ip_address = self.config.ipAddress
File "/nix/store/1z9i3wk9a9z8cldgh28khkwfpk938hrl-python3-3.8.9-env/lib/python3.8/site-packages/nixops/util.py", line 187, in __setattr__
raise AttributeError(f"{self.__class__.__name__} is immutable")
AttributeError: GceStaticIpOptions is immutable
I suspect with low confidence this is because line 29 of nixops_gcp/resources/gce_static_ip.py has:
self.region = self.config.region
which maybe conflicts with how ImmutableValidatedObject already slurps this attribute into its dict and sets itself immutable. I think perhaps name doesn't have this problem, because it sets that value to self.addr_name and likewise ipAddress doesn't have the problem because that is set to self.config.ip_address both of which have different attribute names to the original set so would not conflict with what ImmutableValidatedObject automatically brings in.
I have a GCE static IP I'm trying to define like this:
Without the
region
attribute, this passes validation. Withregion
included I get the following error:I suspect with low confidence this is because line 29 of
nixops_gcp/resources/gce_static_ip.py
has:which maybe conflicts with how
ImmutableValidatedObject
already slurps this attribute into its dict and sets itself immutable. I think perhapsname
doesn't have this problem, because it sets that value toself.addr_name
and likewiseipAddress
doesn't have the problem because that is set toself.config.ip_address
both of which have different attribute names to the original set so would not conflict with whatImmutableValidatedObject
automatically brings in.