Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checklist for adding a new resource #10

Open
4 tasks done
RaitoBezarius opened this issue Oct 25, 2019 · 0 comments
Open
4 tasks done

Checklist for adding a new resource #10

RaitoBezarius opened this issue Oct 25, 2019 · 0 comments

Comments

@RaitoBezarius
Copy link
Member

RaitoBezarius commented Oct 25, 2019

I am in the process of adding a DBSubnetGroup resource to this plugin, I have somehow copied the code from EC2 Security Group resource and tried to adapt everything to make it work, so far I understood I need to:

  • Create a Nix config file, like ec2-rds-dbsubnet-group.nix with mkOption.
  • Add it to the default.nix using evalResources (which I am not sure to understand what it does exactly).
  • Create a Python logic file, like ec2_rds_dbsubnet_group.py which implements a Definition and a State and to ensure in the definition that resource type are matching.
  • Import it into the nixops.resources.__init__.py file.

Did I miss something? While my code is "working", it's not picking up the new resource declaration in one of my infrastructure.nix file.

EDIT: I add that I can see the resource inside my nixops info table, but I don't see it when I try to generate the plan of deployment. I don't know what exactly that means. Also, dependencies are set up so that VPCSubnet are all created before DBSubnet is created and DBInstance depends on DBSubnet, so I am supposed to see the correct order of dependencies and I'm unsure it is the case.

EDIT2: Finally made work a resource.
Basically, it seems like there are different practices to store referenced resources, some includes {name}.{type}.{resourceStateName ? key} when using the DiffEngine, or some override completely and use their own manual diff engine.

I think it'd be great to document how the diff engine works, what is its expectations, to improve its debuggability (I had to chase all the paths of code through many prints…) and maybe generalize it / improve it so that all use case can enter into them (I see some EC2 resources do not use a diff engine, I understand for the EC2 resource, but for others, I believe they can enter in the context of the diff engine).

Also, it'd be great to give some pointers on how to write and compose resources, I suppose it's cool to explain how we can references each resource by generating some identifier which enough data to rebuild the info during traversal.

Also, mixing manual XML stuff and diff engine seems to disable diff engine, I still don't really know why.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant