How to edit the resources defined inside the action of a custom resource?

I need to customize the actions of the tomcat cookbook, i.e. edit a user resource and a template resource and delete another resource.
If I try edit_resource! directly in the recipe, it complains that the resource does not exist (BTW, when running the recipe, the log shows a linux_user resource and not user, but trying to find linux_user also fails).

edit_resource!(:user, 'tomcat_user') do
  gid 'mygroup'
end

Are the resources of a custom resources not visible directly from the recipe? Are they not available until converge (in which case I guess I can try to edit them in a ruby_block, preferably without having to copy/paste the edit_resource code).

PS: I know I can just get the cookbook into my repo and customize it but I’d rather avoid that.

I want to do the same. But think we are doing something wrong or simply comunity cookbook doesnt cover our case...

My case is with postgresql cookbook, i need to edit the service[postgresql] created inside postgresql_server_install in order to disable and stop it immediately after package install.

I would argue that the cookbooks do not cover your use case, as @aL1 just said. I would suggest instead of wanting to change what's inside the resource, just modify the unwanted change in the recipe. For instance, if the resource enables a service, disable it immediately after the resource block ran. I did in the past to remove the symbolic links created by the tomcat cookbook.

Hope this suggestion helps!

Based on the information given, I am not sure what things you want to modify that aren't already exposed as attributes in the tomcat cookbook.

For instance, you can change the gid the tomcat_user gets created with with the tomcat_group variable inside the tomcat_install resource. There should be no editing necessary.

On the template component, I assume youi're referring to the service resource, which looks pretty static. I'd encourage a PR to add the needed functionality into the cookbook, or to examine more closely what changes you're making and why they're necessary.

As a last resort, you can fork the cookbook to introduce your own customizations into the resource. I don't see a reason why you'd want to edit the resource live during a run. Either build your own custom thing, or work to consume the existing cookbook by either modifying your process or submitting in PRs/issues to the cookbook.

I also wouldn't set up behavior that explicitly undoes or changes how something else does things. If you do that, you have not defined an idempotent desired state.