简体   繁体   中英

How to pass connection parameters in pulumi python code

I am trying to convert my logic app ARM template into pulumi . But it is not accepting my connection parameters in the form of JSON. I need to pass my github connection details in the logic app steps

Can you tell me how to do this in pulumi python?

"parameters": {
        "$connections": {
            "value": {
                "github": {
                    "connectionId": "/subscriptions/b417b96c-ff1e-4d07-bc32-74bd70a2a033/resourceGroups/task/providers/Microsoft.Web/connections/github",
                    "connectionName": "github",
                    "id": "/subscriptions/b417b96c-ff1e-4d07-bc32-74bd70a2a033/providers/Microsoft.Web/locations/eastus/managedApis/github"
                }
            }
        }

My code

example_action_custom = azure.logicapps.ActionCustom("exampleActionCustom",
    logic_app_id=example_workflow.id,
    name= "Create_a_repository_using_a_template",
    
    body="""{
    "inputs": {
        "body": {
            "name": "cog-chalnge-pmi-shah-@{triggerBody()?['ghusername']}",
            "owner": "@triggerBody()?['ghusername']",
            "private": true    
        },
        "headers": {
            "Accept": "application/vnd.github.baptiste-preview+json"
        },
        "host": {
            "connection": {
                "name": "@parameters('$connections')['github']['connectionId']"
            }
        },
        "method": "post",
        "parameters": {
            "$connections": {
                "value": {
                    "github": {
                        "connectionId": "/subscriptions/b417b96c-ff1e-4d07-bc32-74bd70a2a033/resourceGroups/bluecode_test_task/providers/Microsoft.Web/connections/github",
                        "connectionName": "github",
                        "id": "/subscriptions/b417b96c-ff1e-4d07-bc32-74bd70a2a033/providers/Microsoft.Web/locations/eastus/managedApis/github"
                    }
                }
            }
        },
        "path": "/repos/@{encodeURIComponent('')}/@{encodeURIComponent('')}/generate"
    },
    "runAfter": {},
    "type": "ApiConnection"
}
""")

在此处输入图片说明

It is not able to create github connector

Useful links which I tried - https://www.pulumi.com/docs/reference/pkg/azure/logicapps/workflow/ https://www.pulumi.com/docs/reference/pkg/azure/logicapps/actioncustom

Parameters cant be passed by azure.logicapps.ActionCustom. I have used another class to pass the workflow azure_native.logic.Workflow.

https://www.pulumi.com/docs/reference/pkg/azure-native/logic/workflow/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM