nixops-aws
nixops-aws copied to clipboard
question: autogenerated route 53 private entries
@rbvermaa
machine_foo = <elided>;
resources.route53RecordSets = {
a-record = { resources, ... }: {
recordValues = [ <expression>];
zoneId = "Z...";
domainName = "www.example.com.";
recordType = "A";
};
};
What machine_foo
? The other Route53 feature in NixOps only allows using the public IP.
The problem is that I cannot just put in a number, because the private IP is assigned by AWS.
according to https://github.com/NixOS/nixops/blob/master/nix/route53-recordset.nix#L84 you can do
recordValues = [ resources.machines.machine_foo ];
(which is how i do it)
but as you asked specifically for the private IPv4: according to https://github.com/NixOS/nixops/blob/master/nixops/resources/route53_recordset.py#L154 passing in a machine definition leads to usage of the publicIPv4 only and there doesnt seem to be a way to use the privateIPv4.
maybe this option is what you are looking for: https://nixos.org/nixops/manual/#opt-deployment.route53.usePublicDNSName
you could always do resources.machines.machine_foo.networking.privateIPv4
but i don't know what public opinion says about this.
@betaboon Your suggestion ("you could always do") fails with The option networking.privateIPv4 is used but not defined.
.
@coretemp that should only happen during --build-only etc as it references the privateIPv4 of the deployed machine. Which prior do being created does not exist. That's the downside of that approach.
@betaboon Thanks for you reply. As you can see, I am not passing --build-only
:
nixops deploy -s localstate.nixops --kill-obsolete -d foo --allow-reboot --show-trace
@coretemp could you share the expression of the machine and the route53RecordSet ?
Any description of my_machine
would do (I expect even an empty one), so just pick the one from the NixOps manual or one of your own.
I think the easiest repro would be just trying to add an expression similar to the one below to one of your existing machines. It will return the same.
resources.route53RecordSets = {
a-record = { resources, nodes, ... }: {
zoneId = "ZSOME_VALID_ID";
domainName = ''www.example.com.'';
ttl = 300;
recordValues = [ (builtins.trace (resources.machines.my_machine.networking.privateIPv4) "1.1.1.1")];
recordType = "A";
};
};
This shouldn't even set the privateIP, it should merely print the value, but even that doesn't work.
@coretemp what version of nixops are you running?
master
@coretemp i just tried that way. can confirm that it doesn't work. which is kind of confusing to me, as i use references to networking.privateIPv4 in different locations like that.
I’ve run into the same issue. Does someone already know how this could be achieved?
Would this help? https://github.com/NixOS/nixops/pull/1054
On this issue, in addition to resources.machines.my_machine.networking.privateIPv4
, I also tried nodes.<ecc-name>.config.networking.privateIPv4
without any success.
Any help ?
Confirm, config.networking.privateIPv4
does not work. Tried with both the passed in config
and nodes.<machine>.config