pulumi / pulumi-google-native

Apache License 2.0
70 stars 18 forks source link

Apigee Error when we update the app adding a new api_product #450

Open LuisAyazo opened 2 years ago

LuisAyazo commented 2 years ago

What happened?

we are getting the following error when we are trying to update the app adding a new api_product to the list.

error: error sending request: googleapi: Error 404: App named 187afbf2-0cec-4a22-a8f2-a23e6e1cfff3 does not exist under devops@univision.net
    Details:
    [
      {
        "@type": "type.googleapis.com/google.rpc.PreconditionFailure",
        "violations": [
          {
            "description": "App named 187afbf2-0cec-4a22-a8f2-a23e6e1cfff3 does not exist under devops@univision.net",
            "subject": "[2002:a17:531:4a0a::]:4470:vtod15:9803:190196:28645030",
            "type": "developer.service.AppDoesNotExist"
          }
        ]
      },
      {
        "@type": "type.googleapis.com/google.rpc.RequestInfo",
        "requestId": "18280987281239287153"
      }
    ]: "https://apigee.googleapis.com/v1/organizations/st-vix-ott-per/developers/devops@univision.net/apps/187afbf2-0cec-4a22-a8f2-a23e6e1cfff3" map[apiProducts:[No anonimus Tokenless Client API Client API Tokenized for Server Apps] developerId:devops@univision.net name:Android]

  pulumi:pulumi:Stack (devops_plm_gcp_infra_apigee-per):
    error: update failed

when i execute the pulumi up the first time, all the resources are created including the apps and the api_products asocciated to that app but when i try to add a new api_product i get that error, i test with the following curl and works:

I am able to create and update the app adding multiples api_product using the curl + googleapi

the other thing to see here is in what moment we can create another credential using this component? because we the googleapi we can create a new credential in the app or just update the credential adding a new api_product.

Steps to reproduce

the component code:

# -*- coding: utf-8 -*-
from typing import Optional, Sequence
​
from pulumi import ComponentResource, ResourceOptions, log
from pulumi_google_native.apigee import v1 as gcp
​
# import pulumi_gcp as gcp
from pydantic import BaseModel
​
__all__ = ["Apps", "AppsArgs"]
​
​
class GoogleCloudApigeeV1AttributeArgs(BaseModel):
    name: Optional[str] = None
    value: Optional[str] = None
​
​
class AppsArgs(BaseModel):
    """
    The arguments necessary to construct a 'Apigee Api Proxy' resource.
    """
​
    # Required
    developer_id: str
    organization_id: str
​
    # Optional
    api_products: Optional[Sequence[str]] = None
    app_family: Optional[str] = None
    app_id: Optional[str] = None
    attributes: Optional[Sequence[GoogleCloudApigeeV1AttributeArgs]] = None
    callback_url: Optional[str] = None
    key_expires_in: Optional[str] = None
    name: Optional[str] = None
    scopes: Optional[Sequence[str]] = None
    status: Optional[str] = None
​
    class Config:
        arbitrary_types_allowed = True
​
​
class Apps(ComponentResource):
    def __init__(
        self,
        resource_name: str,
        # project_id: str,
        args: AppsArgs,
        opts: Optional[ResourceOptions] = None,
    ):
​
        super().__init__(
            t="devops-plm-gcp-infra:apigeeApiProxy/alpha:apigeeApps",
            name=f"{resource_name}-Apigee-Apps",
            props={},
            opts=opts,
        )
        self_parent = self
        child_opts = ResourceOptions(parent=self_parent)
        try:
            gcp.App(
                resource_name=resource_name,
                organization_id=args.organization_id,
                developer_id=args.developer_id,
                api_products=args.api_products,
                app_family=args.app_family,
                app_id=args.app_id,
                attributes=args.attributes,
                callback_url=args.callback_url,
                name=args.name,
                key_expires_in=args.key_expires_in,
                scopes=args.scopes,
                status=args.status,
                opts=child_opts,
            )
        except Exception as ex:
            log.error(f"Apigee Apps -> {ex.args[0]}")

this is the code that call the component:

# -*- coding: utf-8 -*-
"""
This example illustrates how Provider objects can be used to create resources under
different environmental configuration.
"""
# import binascii
# import os
​
# import pulumi
from pulumi import Config, ResourceOptions, StackReference
​
from devops_plm_gcp_infra.apigee.alpha import (
    ApiProduct,
    ApiProductArgs,
    Apps,
    AppsArgs,
    Command,
    CommandArgs,
    Developer,
    DeveloperArgs,
    Envgroup,
    EnvgroupArgs,
    EnvgroupAttachment,
    EnvgroupAttachmentArgs,
    Environment,
    EnvironmentArgs,
    TargetServer,
    TargetServerArgs,
)
​
# Organization,
# OrganizationArgs,
# ApiProxy,
# ApiProxyArgs,
​
# Organization(
# resource_name="devops-pulumi-apigee",
# project_id="st-vix-ott-per",
# args=OrganizationArgs(
# parent="st-vix-ott-per",
# display_name="Apigee",
# description="Apigee for PERF Environment",
# authorized_network="st-vix-ott-per-g-cne-primary",
# analytics_region="us-east1"
# ),
# )
# file_archive = pulumi.FileArchive("./helloworld_rev1_2022_03_28.zip")
# filePath = "./helloworld_rev1_2022_03_28.zip"
# file = open(filePath, "rb")
###############
# from pulumi_command import local
​
# random = local.Command("random",
# create="./create_api_proxi.sh $TOKEN",
# environment={
# "TOKEN": os.environ.get('TOKEN')
# }
# )
​
# pulumi.export("random", random.stdout)
###############
# filePath = "./helloworld_rev1_2022_03_28.zip"
# file = open(filePath, "rb")
# with file:
#     byte = file.read(1)
#     hexadecimal = binascii.hexlify(byte)
#     decimal = int(hexadecimal, 16)
#     binary = bin(decimal)[2:].zfill(8)
#     print("hex: %s, decimal: %s, binary: %s" % (hexadecimal, decimal, binary))
​
# print(binary)
​
​
config = Config()
​
#######################################################################################
# General Config
#######################################################################################
general_cfg = config.require_object("general")
​
business_unit = general_cfg.get("business_unit")
initiative = general_cfg.get("initiative")
platform = general_cfg.get("platform")
environment = general_cfg.get("environment")
default_region = general_cfg.get("default_region")
di = general_cfg.get("di")
​
stack_infra = f"{business_unit}-{initiative}-{platform}-{environment}"
​
common_labels = {"stack": stack_infra, "environment": environment, "di": di}
​
infra = StackReference(f"univision/devops_plm_gcp_infra_apigee/{environment}")
​
​
#######################################################################################
# Apigee Config
#######################################################################################
apigee_cfg = config.require_object("apigee")
​
for cmd in apigee_cfg["develop"]:
    Command(
        resource_name=f"devops-pulumi-apigee-{cmd['api_proxy']}",
        args=CommandArgs(
            create="./create_api_proxi-2.sh",
            dir=".",
            environment={
                "project": stack_infra,
                "name": cmd["api_proxy"],
                "zipfile": cmd["zip_name"],
            },
            interpreter=["/bin/sh", "-c"],
            triggers=[cmd["zip_name"]],
        ),
    )
​
​
for env in apigee_cfg["admin"]["environments"]:
    env_creation = Environment(
        resource_name=f"devops-pulumi-apigee-{env['name']}",
        args=EnvironmentArgs(
            organization_id=stack_infra,
            name=env["name"],
            display_name=env["display_name"],
            description=env["description"],
            api_proxy_type=env["api_proxy_type"],
            deployment_type=env["deployment_type"],
        ),
        opts=ResourceOptions(providers=None, delete_before_replace=True),
    )
​
for group in apigee_cfg["admin"]["env_groups"]:
    group_creation = Envgroup(
        resource_name=f"devops-pulumi-apigee-{group['name']}",
        args=EnvgroupArgs(
            organization_id=stack_infra,
            name=group["name"],
            hostnames=group["hostnames"],
        ),
    )
​
for env_group_attachment in apigee_cfg["admin"]["env_group_attachments"]:
    EnvgroupAttachment(
        resource_name=f"devops-pulumi-apigee-{env_group_attachment['env_group_id']}",
        args=EnvgroupAttachmentArgs(
            organization_id=stack_infra,
            name=env_group_attachment["name"],
            environment=env_group_attachment["environment"],
            envgroup_id=env_group_attachment["env_group_id"],
        ),
        opts=ResourceOptions(
            providers=None,
            depends_on=[env_creation, group_creation],
        ),
    )
​
for target in apigee_cfg["publish"]["target_server"]:
    # print(target['environment'])
    for j in range(len(target["targets"])):
        # print(f"devops-pulumi-apigee-{target['targets'][j]['name']}")
        TargetServer(
            resource_name=f"devops-pulumi-apigee-{target['environment']}-{target['targets'][j]['name']}",
            args=TargetServerArgs(
                organization_id=stack_infra,
                description=target["targets"][j]["description"],
                name=target["targets"][j]["name"],
                environment_id=target["environment"],
                host=target["targets"][j]["host"],
                is_enabled=target["targets"][j]["is_enabled"],
                port=target["targets"][j]["port"],
                protocol=target["targets"][j]["protocol"],
                s_sl_info=target["targets"][j]["ssl_info"],
            ),
            opts=ResourceOptions(
                providers=None,
                delete_before_replace=True,
                depends_on=[
                    env_creation,
                ],
            ),
        )
​
for dev in apigee_cfg["publish"]["developer"]:
    developer = Developer(
        resource_name=f"devops-pulumi-apigee-{dev['email']}",
        args=DeveloperArgs(
            organization_id=stack_infra,
            email=dev['email'],
            user_name=dev['username'],
            first_name=dev['firstname'],
            last_name=dev['lastname'],
            apps=[],
        ),
    )
​
for product in apigee_cfg["publish"]["api_products"]:
    products = ApiProduct(
        resource_name=f"devops-pulumi-apigee-{product['name']}",
        args=ApiProductArgs(
            organization_id=stack_infra,
            name=product["name"],
            display_name=product["display_name"],
            description=product["description"],
            environments=product["environments"],
            attributes=[{"name": "access", "value": "internal"}],
            approval_type="auto",
        ),
        opts=ResourceOptions(
            providers=None,
            # depends_on=[
            #     apps
            # ],
        ),
    )
​
​
for app in apigee_cfg["publish"]["apps"]:
​
    for j in range(len(app["app"])):

        apps = Apps(
            resource_name=f"devops-pulumi-apigee-{app['app'][j]['name']}",
            args=AppsArgs(
                organization_id=stack_infra,
                developer_id=app["developer_id"],
                name=app['app'][j]["name"],
                api_products=app['app'][j]["api_products"],
            ),
            opts=ResourceOptions(
                providers=None,
                depends_on=[developer, products],
            ),
        )

and the yaml file

config:
  devops_plm_gcp_infra_apigee:general:
    business_unit: st
    initiative: vix
    platform: ott
    environment: per
    default_region: us-east1
    di: 301020-570877-0112-600280-00000
  devops_plm_gcp_infra_apigee:apigee:
    develop:
      - api_proxy: test
        zip_name: helloworld_rev1_2022_03_29.zip
      - api_proxy: client-api-tokenless
        zip_name: client-api-tokenless_rev8_2022_04_01.zip
    publish:
      developer:
        - email: devops@univision.net
          username: devops
          firstname: vix1
          lastname: vix1
        - email: devops1@univision.net
          username: devops1
          firstname: vix1
          lastname: vix1
      api_products:
        - name: "No anonimus"
          display_name: "NOOOO anon"
          description: "Prueba de description product1"
          environments:
            - env-test
        - name: "Tokenless Client API"
          display_name: "Tokenless Client API"
          description: "Client API endpoint that doesn't require a token, and instead uses API keys for all clients"
          environments:
            - env-test
        - name: "Client API Tokenized for Server Apps"
          display_name: "Client API Tokenized for Server Apps"
          description: "This version requires a token. This app exists so that we can assign API keys for use by server-side applications like web SSR"
          environments:
            - env-test
        - name: "Client API Tokenized for Server Apps 2"
          display_name: "Client API Tokenized for Server Apps 2"
          description: "This version requires a token. This app exists so that we can assign API keys for use by server-side applications like web SSR"
          environments:
            - env-test
      apps:
        - developer_id: devops@univision.net 
          app:
            - name: Android #mover al bloque de developer apps: name -> api_products
              api_products:
                - 'No anonimus'
                - 'Tokenless Client API'
                - 'Client API Tokenized for Server Apps'
            - name: Apple #mover al bloque de developer apps: name -> api_products
              api_products:
                - 'No anonimus'
                - 'Tokenless Client API'
        - developer_id: devops1@univision.net
          app: 
            - name: Android2 #mover al bloque de developer apps: name -> api_products
              api_products:
                - 'No anonimus'
                - 'Tokenless Client API'
                - 'Client API Tokenized for Server Apps'
                - 'Client API Tokenized for Server Apps 2'
      target_server:
        - environment: "env-test"
          targets:
            -
              name: "Target-server-env-test" # no space allowed
              description: "target server env test dev"
              host: "origin-client-ent-test-api.de.vix.tv"
              is_enabled: True
              port: 443
              protocol: HTTP
              ssl_info:
                enabled: True
            -
              name: "Target-server-env-test2" # no space allowed
              description: "target server env test dev"
              host: "origin-client-ent-test-api.de.vix.tv"
              is_enabled: True
              port: 443
              protocol: HTTP
              ssl_info:
                enabled: True
            -
              name: "Target-server-env-test3" # no space allowed
              description: "target server env test dev3"
              host: "origin-client-ent-test-api3.de.vix.tv"
              is_enabled: True
              port: 443
              protocol: HTTP
              ssl_info:
                enabled: True
            -
              name: "client-api-loadbalancer" # no space allowed
              description: "client-api-loadbalancer"
              host: "origin-client-api.per.vix.tv"
              is_enabled: True
              port: 443
              protocol: HTTP
              ssl_info:
                enabled: True
        - environment: "default-client-api-per"
          targets:
            -
              name: "client-api-loadbalancer" # no space allowed
              description: "target server env test dev"
              host: "origin-client-api.per.vix.tv"
              is_enabled: True
              port: 443
              protocol: HTTP
              ssl_info:
                enabled: True
            -
              name: "Target-server-env-test 4" # no space allowed
              description: "target server env test dev"
              host: "origin-client-ent-test-api.de.vix.tv"
              is_enabled: True
              port: 443
              protocol: HTTP
              ssl_info:
                enabled: True
    admin:
      environments:
        - name: env-test
          display_name: display test
          description: description relate to the env
          api_proxy_type: PROGRAMMABLE
          deployment_type: PROXY
      env_groups:
        - name: test-per
          hostnames:
            - apigee.test-per.vix.tv
            - apigee.test1-per.vix.tv
        - name: test-per-2
          hostnames:
            - apigee.test-per3.vix.tv
            - apigee.test1-per4.vix.tv
      env_group_attachments:
        - name: group1
          env_group_id: test-per
          environment: env-test

Expected Behavior

I expect that i be able to update the app/credencial adding new api_products to the array list.

Actual Behavior

i get some error related to the app name but the name returned is not the name but the appid error: App named 187afbf2-0cec-4a22-a8f2-a23e6e1cfff3 does not exist under devops@univision.net the app name is Android and the id is 187afbf2-0cec-4a22-a8f2-a23e6e1cfff3

using the googleapis when i try yo update the app putting a wrong name the error shows me the name of the app not the id.

Versions used

CLI Version Go Version go1.17.8 Go Compiler gc

Plugins NAME VERSION command 0.0.3 gcp 6.19.0 google-native 0.18.0 mongodbatlas 3.2.0 python unknown random 4.3.1

Host OS darwin Version 11.6.5 Arch x86_64

This project is written in python (/usr/local/bin/python3 v3.9.12)

Current Stack: univision/per

TYPE URN pulumi:pulumi:Stack urn:pulumi:per::devops_plm_gcp_infra_apigee::pulumi:pulumi:Stack::devops_plm_gcp_infra_apigee-per devops-plm-gcp-infra:apigeeCommand/alpha:apigeeCommand urn:pulumi:per::devops_plm_gcp_infra_apigee::devops-plm-gcp-infra:apigeeCommand/alpha:apigeeCommand::devops-pulumi-apigee-test-Apigee-Command devops-plm-gcp-infra:environment/alpha:Environment urn:pulumi:per::devops_plm_gcp_infra_apigee::devops-plm-gcp-infra:environment/alpha:Environment::devops-pulumi-apigee-env-test-Environment devops-plm-gcp-infra:envgroup/alpha:Envgroup urn:pulumi:per::devops_plm_gcp_infra_apigee::devops-plm-gcp-infra:envgroup/alpha:Envgroup::devops-pulumi-apigee-test-per-Envgroup devops-plm-gcp-infra:envgroup/alpha:Envgroup urn:pulumi:per::devops_plm_gcp_infra_apigee::devops-plm-gcp-infra:envgroup/alpha:Envgroup::devops-pulumi-apigee-test-per-2-Envgroup devops-plm-gcp-infra:apigeeCommand/alpha:apigeeCommand urn:pulumi:per::devops_plm_gcp_infra_apigee::devops-plm-gcp-infra:apigeeCommand/alpha:apigeeCommand::devops-pulumi-apigee-client-api-tokenless-Apigee-Command pulumi:providers:pulumi urn:pulumi:per::devops_plm_gcp_infra_apigee::pulumi:providers:pulumi::default pulumi:providers:command urn:pulumi:per::devops_plm_gcp_infra_apigee::pulumi:providers:command::default_0_0_3 command:local:Command urn:pulumi:per::devops_plm_gcp_infra_apigee::devops-plm-gcp-infra:apigeeCommand/alpha:apigeeCommand$command:local:Command::devops-pulumi-apigee-test pulumi:providers:google-native urn:pulumi:per::devops_plm_gcp_infra_apigee::pulumi:providers:google-native::default_0_18_0 google-native:apigee/v1:Envgroup urn:pulumi:per::devops_plm_gcp_infra_apigee::devops-plm-gcp-infra:envgroup/alpha:Envgroup$google-native:apigee/v1:Envgroup::devops-pulumi-apigee-test-per google-native:apigee/v1:Environment urn:pulumi:per::devops_plm_gcp_infra_apigee::devops-plm-gcp-infra:environment/alpha:Environment$google-native:apigee/v1:Environment::devops-pulumi-apigee-env-test google-native:apigee/v1:Envgroup urn:pulumi:per::devops_plm_gcp_infra_apigee::devops-plm-gcp-infra:envgroup/alpha:Envgroup$google-native:apigee/v1:Envgroup::devops-pulumi-apigee-test-per-2 command:local:Command urn:pulumi:per::devops_plm_gcp_infra_apigee::devops-plm-gcp-infra:apigeeCommand/alpha:apigeeCommand$command:local:Command::devops-pulumi-apigee-client-api-tokenless devops-plm-gcp-infra:apigeeTargetServer/alpha:apigeeTargetServer urn:pulumi:per::devops_plm_gcp_infra_apigee::devops-plm-gcp-infra:apigeeTargetServer/alpha:apigeeTargetServer::devops-pulumi-apigee-env-test-Target-server-env-test-Apigee-TargetServer devops-plm-gcp-infra:apigeeTargetServer/alpha:apigeeTargetServer urn:pulumi:per::devops_plm_gcp_infra_apigee::devops-plm-gcp-infra:apigeeTargetServer/alpha:apigeeTargetServer::devops-pulumi-apigee-env-test-Target-server-env-test2-Apigee-TargetServer devops-plm-gcp-infra:apigeeTargetServer/alpha:apigeeTargetServer urn:pulumi:per::devops_plm_gcp_infra_apigee::devops-plm-gcp-infra:apigeeTargetServer/alpha:apigeeTargetServer::devops-pulumi-apigee-env-test-client-api-loadbalancer-Apigee-TargetServer devops-plm-gcp-infra:apigeeTargetServer/alpha:apigeeTargetServer urn:pulumi:per::devops_plm_gcp_infra_apigee::devops-plm-gcp-infra:apigeeTargetServer/alpha:apigeeTargetServer::devops-pulumi-apigee-env-test-Target-server-env-test3-Apigee-TargetServer devops-plm-gcp-infra:apigeeApiProducts/alpha:apigeeApiProducts urn:pulumi:per::devops_plm_gcp_infra_apigee::devops-plm-gcp-infra:apigeeApiProducts/alpha:apigeeApiProducts::devops-pulumi-apigee-No_anonimus-Apigee-ApiProducts devops-plm-gcp-infra:apigeeDeveloper/alpha:apigeeDeveloper urn:pulumi:per::devops_plm_gcp_infra_apigee::devops-plm-gcp-infra:apigeeDeveloper/alpha:apigeeDeveloper::devops-pulumi-apigee-devops@univision.net-Apigee-Developer devops-plm-gcp-infra:apigeeDeveloper/alpha:apigeeDeveloper urn:pulumi:per::devops_plm_gcp_infra_apigee::devops-plm-gcp-infra:apigeeDeveloper/alpha:apigeeDeveloper::devops-pulumi-apigee-devops1@univision.net-Apigee-Developer devops-plm-gcp-infra:apigeeEnvgroupAttachment/alpha:apigeeEnvgroupAttachment urn:pulumi:per::devops_plm_gcp_infra_apigee::devops-plm-gcp-infra:apigeeEnvgroupAttachment/alpha:apigeeEnvgroupAttachment::devops-pulumi-apigee-test-per-Apigee-EnvgroupAttachment devops-plm-gcp-infra:apigeeApiProducts/alpha:apigeeApiProducts urn:pulumi:per::devops_plm_gcp_infra_apigee::devops-plm-gcp-infra:apigeeApiProducts/alpha:apigeeApiProducts::devops-pulumi-apigee-Tokenless_Client_API-Apigee-ApiProducts devops-plm-gcp-infra:apigeeApiProducts/alpha:apigeeApiProducts urn:pulumi:per::devops_plm_gcp_infra_apigee::devops-plm-gcp-infra:apigeeApiProducts/alpha:apigeeApiProducts::devops-pulumi-apigee-Client_API_Tokenized_for_Server_Apps-Apigee-ApiProducts google-native:apigee/v1:TargetServer urn:pulumi:per::devops_plm_gcp_infra_apigee::devops-plm-gcp-infra:apigeeTargetServer/alpha:apigeeTargetServer$google-native:apigee/v1:TargetServer::devops-pulumi-apigee-env-test-Target-server-env-test2 google-native:apigee/v1:TargetServer urn:pulumi:per::devops_plm_gcp_infra_apigee::devops-plm-gcp-infra:apigeeTargetServer/alpha:apigeeTargetServer$google-native:apigee/v1:TargetServer::devops-pulumi-apigee-env-test-client-api-loadbalancer google-native:apigee/v1:TargetServer urn:pulumi:per::devops_plm_gcp_infra_apigee::devops-plm-gcp-infra:apigeeTargetServer/alpha:apigeeTargetServer$google-native:apigee/v1:TargetServer::devops-pulumi-apigee-env-test-Target-server-env-test google-native:apigee/v1:ApiProduct urn:pulumi:per::devops_plm_gcp_infra_apigee::devops-plm-gcp-infra:apigeeApiProducts/alpha:apigeeApiProducts$google-native:apigee/v1:ApiProduct::devops-pulumi-apigee-No_anonimus google-native:apigee/v1:Developer urn:pulumi:per::devops_plm_gcp_infra_apigee::devops-plm-gcp-infra:apigeeDeveloper/alpha:apigeeDeveloper$google-native:apigee/v1:Developer::devops-pulumi-apigee-devops1@univision.net google-native:apigee/v1:TargetServer urn:pulumi:per::devops_plm_gcp_infra_apigee::devops-plm-gcp-infra:apigeeTargetServer/alpha:apigeeTargetServer$google-native:apigee/v1:TargetServer::devops-pulumi-apigee-env-test-Target-server-env-test3 google-native:apigee/v1:EnvgroupAttachment urn:pulumi:per::devops_plm_gcp_infra_apigee::devops-plm-gcp-infra:apigeeEnvgroupAttachment/alpha:apigeeEnvgroupAttachment$google-native:apigee/v1:EnvgroupAttachment::devops-pulumi-apigee-test-per google-native:apigee/v1:ApiProduct urn:pulumi:per::devops_plm_gcp_infra_apigee::devops-plm-gcp-infra:apigeeApiProducts/alpha:apigeeApiProducts$google-native:apigee/v1:ApiProduct::devops-pulumi-apigee-Client_API_Tokenized_for_Server_Apps google-native:apigee/v1:ApiProduct urn:pulumi:per::devops_plm_gcp_infra_apigee::devops-plm-gcp-infra:apigeeApiProducts/alpha:apigeeApiProducts$google-native:apigee/v1:ApiProduct::devops-pulumi-apigee-Tokenless_Client_API google-native:apigee/v1:Developer urn:pulumi:per::devops_plm_gcp_infra_apigee::devops-plm-gcp-infra:apigeeDeveloper/alpha:apigeeDeveloper$google-native:apigee/v1:Developer::devops-pulumi-apigee-devops@univision.net devops-plm-gcp-infra:apigeeApiProxy/alpha:apigeeApps urn:pulumi:per::devops_plm_gcp_infra_apigee::devops-plm-gcp-infra:apigeeApiProxy/alpha:apigeeApps::devops-pulumi-apigee-Android-Apigee-Apps devops-plm-gcp-infra:apigeeApiProxy/alpha:apigeeApps urn:pulumi:per::devops_plm_gcp_infra_apigee::devops-plm-gcp-infra:apigeeApiProxy/alpha:apigeeApps::devops-pulumi-apigee-Apple-Apigee-Apps google-native:apigee/v1:App urn:pulumi:per::devops_plm_gcp_infra_apigee::devops-plm-gcp-infra:apigeeApiProxy/alpha:apigeeApps$google-native:apigee/v1:App::devops-pulumi-apigee-Android pulumi:pulumi:StackReference urn:pulumi:per::devops_plm_gcp_infra_apigee::pulumi:pulumi:StackReference::univision/devops_plm_gcp_infra_apigee/per google-native:apigee/v1:App urn:pulumi:per::devops_plm_gcp_infra_apigee::devops-plm-gcp-infra:apigeeApiProxy/alpha:apigeeApps$google-native:apigee/v1:App::devops-pulumi-apigee-Apple

Found no pending operations associated with univision/per

Backend Name pulumi.com URL https://app.pulumi.com/pichipaul User pichipaul

NAME VERSION aiodns 3.0.0 asyncio 3.4.3 autopep8 1.5.7 bcrypt 3.2.0 black 21.8b0 boto3 1.18.55 Cerberus 1.3.4 ddtrace 0.51.1 devops-plm-gcp-infra 1.28.0 email-validator 1.1.3 fastapi 0.67.0 google-api-python-client 2.19.1 google-auth-oauthlib 0.4.6 ipython 7.26.0 jaeger-client 4.6.0 lockfile 0.12.2 locust 2.1.0 mailjet-rest 1.3.4 motor 2.5.0 opentracing-instrumentation 3.3.1 passlib 1.7.4 pip 22.0.4 poetry 1.1.11 pre-commit 2.15.0 pulumi-command 0.0.3 PyJWT 2.1.0 pytest-cov 3.0.0 python-decouple 3.4 python-multipart 0.0.5 slackclient 2.9.3 UnleashClient 4.4.1 uvicorn 0.14.0 wheel 0.37.1

Pulumi locates its logs in /var/folders/0z/z7p0n8197g3fbytpzry587lr0000gp/T/ by default warning: A new version of Pulumi is available. To upgrade from version '0.0.0' to '3.29.1', run $ brew upgrade pulumi or visit https://pulumi.com/docs/reference/install/ for manual instructions and release notes.

Additional context

i thing inside the code is necessary to fix the name of the app but beside it should be a way to tell the component (app) if we want to create a new credential or update an existent app adding more products.

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

guineveresaenger commented 2 years ago

hi @LuisAyazo - it would help us a lot if you could reformat your issue to include code fences and remove extraneous markdown headers 💟

LuisAyazo commented 2 years ago

Hi @guineveresaenger now it looks better. all the codes were formatted.

MitchellGerdisch commented 2 years ago

Did some digging into this with guineveresaenger In a nutshell:

FWIW, this simplified code along with the the app.py component resource and yaml file shared above can be used to reproduce the problem as follows

# import pulumi
from pulumi import Config, ResourceOptions, StackReference
from apps import Apps, AppsArgs
config = Config()
general_cfg = config.require_object("general")

business_unit = general_cfg.get("business_unit")
initiative = general_cfg.get("initiative")
platform = general_cfg.get("platform")
environment = general_cfg.get("environment")
default_region = general_cfg.get("default_region")
di = general_cfg.get("di")

stack_infra = f"{business_unit}-{initiative}-{platform}-{environment}"

common_labels = {"stack": stack_infra, "environment": environment, "di": di}

apigee_cfg = config.require_object("apigee")

for app in apigee_cfg["publish"]["apps"]:

    for j in range(len(app["app"])):

        apps = Apps(
            resource_name=f"devops-pulumi-apigee-{app['app'][j]['name']}",
            args=AppsArgs(
                organization_id="GCP PROJECT NAME GOES HERE",
                developer_id=app["developer_id"],
                name=app['app'][j]["name"],
                api_products=app['app'][j]["api_products"],
            ),
            opts=ResourceOptions(
                providers=None,
            ),
        )