O Cloud Deployment Manager vai chegar ao fim do suporte em 31 de dezembro de 2025. Se você usa o Deployment Manager, migre para o Infrastructure Manager ou uma tecnologia de implantação alternativa até 31 de dezembro de 2025 para garantir que seus serviços continuem sem interrupções.
Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
A partir de 1º de janeiro de 2020, a comunidade do Python não atualizará mais o Python 2.7, nem corrigirá bugs ou problemas de segurança dele. Recomendamos que você verifique assim que possível se seus modelos do Deployment Manager são compatíveis com o Python 3.
Para ter uma visão geral dos produtos afetados por essa alteração, incluindo informações
sobre como usar as bibliotecas de cliente do Google Cloud Python, consulte o
suporte a Python no Google Cloud.
Como migrar os modelos do Deployment Manager
A sintaxe do Deployment Manager não usa nenhum recurso específico ao Python 3. Na maioria dos casos, os modelos devem funcionar com o Python 3 sem exigir alterações de código.
Se você usar módulos de modelo, como scripts auxiliares, verifique se os scripts são compatíveis com o Python 3.
Para mais informações sobre como portar o código Python 2 para o Python 3, consulte o guia de portabilidade do Python.org.
Se você quer testar se um modelo é compatível com o Python 3, tente uma implantação de teste com o modelo. Se a implantação for bem-sucedida sem nenhum aviso, o modelo é compatível e não precisa de alterações.
Se os modelos tiverem recursos incompatíveis com o Python 3, suas implantações continuarão funcionando até junho de 2020. Pode ser que você receba um destes avisos:
O modelo é incompatível com o Python 3: o modelo é executado usando o Python 2, mas falha com o Python 3. O aviso mostra a mensagem de erro do Python 3, para que você possa depurar o código.
O modelo produziu resultados diferentes com o Python 3 e o Python 2: isso pode acontecer porque a implantação não é determinística (por exemplo, depende do horário atual ou de números aleatórios) ou um modelo pode estar usando um recurso incompatível com o Python 3. Se o modelo não é determinístico por design, não é necessário alterá-lo.
Se o modelo usar um recurso incompatível com o Python 3,
use as diretrizes no
guia de portabilidade do Python 3
para atualizar o modelo.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-09-03 UTC."],[[["\u003cp\u003ePython 2.7 will no longer receive updates, bug fixes, or security patches from the Python community after January 1, 2020, so ensuring Deployment Manager templates are compatible with Python 3 is advised.\u003c/p\u003e\n"],["\u003cp\u003eDeployment Manager templates generally do not require code changes to be compatible with Python 3, unless template modules or helper scripts are used.\u003c/p\u003e\n"],["\u003cp\u003eTesting templates for Python 3 compatibility can be done by attempting a test deployment, which, if successful without warnings, indicates compatibility.\u003c/p\u003e\n"],["\u003cp\u003eTemplates incompatible with Python 3 will continue to function until June 2020, but may produce warnings indicating incompatibility or different results compared to Python 2.\u003c/p\u003e\n"],["\u003cp\u003eThe Python.org porting guide can help users with migration of incompatible features to Python 3 if needed.\u003c/p\u003e\n"]]],[],null,["# Migrate your templates to Python 3\n\n[Starting on January 1, 2020](https://www.python.org/doc/sunset-python-2/),\nthe Python community will no longer update,\nfix bugs, or patch security issues for Python 2.7. We recommend that you make\nsure that your Deployment Manager templates are compatible with Python 3 as\nsoon as possible.\n\nFor an overview of the products affected by this change, including information\nabout using the Google Cloud Python client libraries, see\n[Python support on Google Cloud](/python/docs/python2-sunset).\n\nMigrating your Deployment Manager templates\n-------------------------------------------\n\nThe syntax for Deployment Manager does not use any features specific to\nPython 3. In most cases, your templates should work with Python 3 without\nrequiring code changes.\n\nIf you use [template modules](/deployment-manager/docs/configuration/templates/create-template-modules)\nsuch as helper scripts, you must make sure that the scripts are compatible with\nPython 3.\n\nFor information on porting Python 2 code to Python 3, see the\n[Python.org porting guide](https://docs.python.org/3/howto/pyporting.html).\nIf you want to test whether your template is compatible with\nPython 3, try a test deployment with the template. If the deployment succeeds\nwithout any warnings, your template is compatible, and doesn't need changes.\n\nIf your templates have features that are incompatible with Python 3, your\ndeployments will continue to work until June 2020. You might see one of\nthese warnings:\n\n- The template is incompatible with Python 3: The template runs using Python 2,\n but fails with Python 3. The warning shows the Python 3 error message, so that\n you can debug your code.\n\n- The template produced different results with Python 3 and Python 2: This\n could be because your deployment is non-deterministic (for example, it relies\n on the current time or random numbers), or a template might be using a feature\n incompatible with Python 3. If your template is non-deterministic by design,\n you don't need to change it.\n\n If your template uses a feature that is incompatible with Python 3,\n use the guidelines in the\n [Python 3 porting guide](https://docs.python.org/3/howto/pyporting.html)\n to update the template."]]