How can I use apigee-config-maven-plugin across multiple orgs?

I want to use a single edge.json file for my API products, Developers and Apps across my non-prod and prod orgs, each having different environments. Here's the org level portion of my edge.json

"orgConfig": {
    "apiProducts": [
        {
            "name": "template-v1-product-cicd",
            "apiResources": [
                "/",
                "/**"
            ],
            "approvalType": "auto",
            "attributes": [
                {
                    "name": "description",
                    "value": "Product to test template API for CI/CD"
                }
            ],
            "description": "Product to test template-v1 API",
            "displayName": "template-v1-product-cicd",
            "environments": [
                "dev", "qa", "stage",
                "sandbox", "prod"
            ],
            "proxies": [
                "identity-v1",
                "template-v1"
            ],
            "quota": "10000",
            "quotaInterval": "1",
            "quotaTimeUnit": "month",
            "scopes": []
        }
    ]
}

In my case dev, qa and stage are in non-prod org and sandbox and prod are in prod org.

When I run:

mvn apigee-config:apiproducts -Psandbox -Dapigee.config.options=update

I get the error:

[ERROR] {
[ERROR]   "code" : "keymanagement.service.InvalidEnvironment",
[ERROR]   "message" : "Invalid environment dev",
[ERROR]   "contexts" : [ ]
[ERROR] }

which is as expected, but how do I achieve what I want?

It seems there ought to be a similar structure as per envConfig which allows me to specify the environment name

"envConfig": {
    "dev": {
        "targetServers": []

Anyone else doing this?

0 3 615
3 REPLIES 3

You are heading in the right direction. Thanks for asking.

Some thoughts are here.

https://github.com/apigee/apigee-config-maven-plugin/wiki/Organize-config-in-a-large-project

All "orgconfig" can be organized by Edge orgs.

my-nonprod/resources/edge.json

my-prod/resources/edge.json

envConfig and apiConfig can be organized by project or API.

Thanks @Madhan Sadasivam I didn't see the Wiki before. This may help, need to think about it. My goal is to have a single repository and build job triggered by source code change. I suppose I could create 2 repositories, one for non-prod and one for prod.

Seeing as I want to have a single repository and single build job triggered by changes, I've used copy-resources and replacer to change the environments for an "apiproduct" for each org (non-prod and prod).