MODx : Container resource vs. resource's parent - modx

What are the use of container resource and the use of resource's parent?
Are they relevant to each other?

We need more information, but I will try my best.
Im going to assume that Container Resources and Parent Resources are the same things.
Parent resources are resources (aka pages) that have child resources under them. You can use a parent resource to organise your resources on the site, eg: using the getResource plugin to display all child resources on a page.
You can also use Wayfinder to display child resources as sub menus.
Example of getResources call:
[[!getResources? &parents=`5` &limit=`10` &tpl=`blogPost`]]
This is saying:
"Get the child resources of the parent resource with ID 5. Limit the
number of child resources returned to 10. Render them with the
template blogPost"

Related

How to create a resource group that can be shared between modules in terraform?

What is the proper way to create a resource group in terraform for azure that can be shared across different modules? I've been banging my head against this for a while and it's not working. As you can see in this image. I have a resource group in a separate folder. In my main.tf file i load the modules appservice and cosmosdb. I cant seem to figure out how to make the appservice and cosmosdb tf files reference the resource group here that is in this location. How is this done? Any suggestions would be greatly appreciated. Thank you.
In general, it is not recommended to have a module with a single resource like you have organized your code. However, in this situation, you would need to provide the exported resource attributes as an output for that module. In your resource_group module:
output "my_env_rg" {
value = azurerm_resource_group.rg
description = "The my-env-rg Azure resource group."
}
Then, the output containing the map of exported resource attributes for the resource becomes accessible in a config module where you have declared the module. For example, in your root module config (presumably containing your main.tf referenced in the question):
module "azure_resource_group" {
source = "resource-group"
}
would make the output accessible with the namespace module.<MODULE NAME>.<OUTPUT NAME>. In this case, that would be:
module.azure_resource_group.my_env_rg
There's two different kinds of sharing that require different solutions. You need to decide which kind of sharing you're looking for because your example isn't very illustrative.
The first is where you want to make a pattern of creating things that you want to use twice. The goal is to create many different things, each with different parameters. The canonical example is a RDS instance or an EC2 instance. Think of the Terraform module as a function where you execute it with different inputs in different places and use the different results independently. This is exactly what Terraform modules are for.
The second is where you want to make a thing and reference it in multiple places. The canonical example is a VPC. You don't want to make a new VPC for every autoscaling group - you want to reuse it.
Terraform doesn't have a good way of stitching the outputs from one set of resources as inputs to another set. Atlas does and Cloudformation does as well. If you're not using those, then you have to stitch them together yourself. I have always written a wrapper around Terraform which enables me to do this (and other things, like validation and authentication). Save the outputs to a known place and then reference them as inputs later.

How does one get the Tags of an AWS resource by its ARN?

I'm working on a service that I want to use to monitor tags and enforce tagging policies.
One planned feature is to detect resources that are tagged with a value that is not allowed for the respective key.
I can already list the ARNs of resources that have a certain tag-key and I am now looking to filter this list of resources according to invalid values. To do that I want to query a list of each resources tags using its ARN and then filter by those that have invalid values in their tags.
I have
[{
"ResourceArn":"arn:aws:ec2:eu-central-1:123:xyz",
"ResourceType":"AWS::Service::Something
}, ...]
and I want to do something like
queryTags("arn:aws:ec2:eu-central-1:123:xyz")
to get the tags of the specified resource.
I'm using nodejs, but I'm happy to use a solution based on the AWS cli or anything else that can be used in a script.
You can use that through awscli.
For example, EC2 has the command describe-tags for listing the tags of resources and I think other resources also have command like this. It also has options that meet your need.
https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-tags.html

List all viewflow processes the user is allowed to

I'm trying to implement django-viewflow in my project, using django-admin as a GUI.
I'm currently trying to create a custom view and relative template to show a user a list of all the processes that he can start,
so not the process instances but a list of process models he's allowed to see.
Is it possible? I tried using the ProcessListView but it requires a flow_class, while I'd like to see all flows the user is allowed to.
You can get available process instances with Process.objects.filter_available([flow_class1, flow_class2, ...], user)

Puppet how to check that exec resource is not getting applied

I am working on a project which contains a module with nearly 100 of exec resources guarded by creates attribute to ensure that exec resource is idempotent.
On applying puppet class, it just logs only those resources which are getting applied but not the other resources which are not getting applied.
I am trying to refactor module and want to get list of all resources in that module along with their status like applied , not applied etc. If any of the resource is not getting applied then also the reason why it's not getting applied.
Is there any way to produce such a report in puppet.
Thanks

Modx - Multiple contexts on one domain

I've a Modx site running. Now i want to get some resources like modx-generated javascript files. It is possible to put these in the web context, but than it can be seen by all users.
So i created a new context named "Resources" (key: res), gave it Load-Only permissions and created a resource in it. I've also initialize it in the index.php file:
$modx->initialize('web');
$modx->initialize('res');
But when i try to access the resource, it doesn't work.
Did i missed something?
Calling modX::initialize() twice will not work as it checks for state.
Either remove the first call to initailise the web state or write a plugin and use modX::switchContext()

Resources