Copilot는 Azure 인프라를 정의하는 Terraform 구성을 생성하는 데 도움이 될 수 있습니다. 배포하려는 인프라를 설명하고, Copilot는 AzureRM 공급자를 사용하여 Terraform 구성을 생성합니다. 구성에는 구성을 배포할 수 있도록 주 리소스와 필요한 종속성이 모두 자동으로 포함됩니다. 후속 프롬프트를 반복적으로 만들어 출력을 정의할 수 있습니다.
이 문서에서는 Azure Portal에서 Azure의 Copilot 를 사용하고 Visual Studio Code의 Azure용 GitHub Copilot를 사용하는 방법에 대해 알아봅니다. 또한 원하는 대로 as-is 사용하거나 편집할 수 있는 샘플 Terraform 프롬프트도 제공합니다.
Tip
최상의 결과를 위해 프롬프트를 8개 미만의 기본 Terraform 리소스 유형으로 유지합니다. 코파일럿은 일반적인 구성에서 성능이 뛰어납니다. 복잡하거나 대규모 아키텍처는 불완전하거나 덜 정확한 결과를 생성할 수 있습니다.
Note
Copilot는 현재 AzureRM 공급자 리소스를 광범위하게 지원합니다. AzAPI 공급자에 대한 지원은 진화하고 있으며 아직 완전히 사용할 수 없습니다. 필요한 리소스 종류가 지원되지 않는 경우 Copilot는 샘플 구조로 돌아가거나 제한 사항을 설명합니다.
Azure 포털에서 Copilot 사용
Azure Portal을 엽니다.
오른쪽 위 모서리에서 코필로트 아이콘을 선택합니다.
다음 예제와 같이 Terraform 관련 프롬프트를 입력합니다.
Create a Terraform configuration for a Cognitive Services instance named "mycognitiveservice" and the S0 pricing tierEnter 키를 누릅니<다>.
Azure의 코필로트가 응답하면 전체 보기 열기 를 선택하여 전체 화면 모드에서 구성 코드 블록을 볼 수 있습니다.
복사 아이콘을 선택하여 새 구성을 클립보드에 복사합니다.
코드를 편집기에 붙여넣습니다.
Visual Studio Code에서 Azure용 GitHub Copilot 사용
Visual Studio Code를 엽니다.
작업 모음에서 확장을 선택하고
copilot을 검색합니다.
GitHub Copilot 확장이 설치되어 있는지 확인합니다. 그렇지 않은 경우 설치합니다.
GitHub Copilot 채팅 확장이 설치되어 있는지 확인합니다. 그렇지 않은 경우 설치합니다.
채팅 전환을 선택합니다.
Terraform 구성에서
@azure로 시작하는 프롬프트를 입력합니다. 예를 들어 다음 프롬프트는 다양한 설정을 사용하여 CDN(Content Delivery Network) 리소스를 만듭니다.@azure Use Terraform to create an Azure CDN Front Door profile named "myCDN profile" with a custom ___domain association for "example.com". Configure a CDN Front Door route that links to the default ___domain, and create a CDN endpoint named "myEndpoint" associated with the custom ___domain. Ensure that a security policy is applied for enhanced protection in production, and verify that the route is correctly configured with the appropriate origin group.Enter 키를 누릅니<다>.
Azure용 GitHub Copilot는 프로세스를 대화형으로 안내하고 구성에 필요한 파일을 만듭니다.
파일이 생성되거나 업데이트되면, Azure용 GitHub Copilot은 생성된 구성에 대해
terraform init및terraform validate명령을 실행할 것을 제안합니다.
샘플 Terraform 프롬프트 검토 및 사용
이 섹션에는 Terraform 구성을 생성하는 데 사용할 수 있는 몇 가지 예제 프롬프트가 포함되어 있습니다. 시나리오에 따라 이러한 프롬프트를 수정하거나 다른 프롬프트를 시도하여 다른 종류의 쿼리를 만듭니다.
Create a Terraform configuration for a Cognitive Services instance with
name "mycognitiveservice" and S0 pricing tier.
Create a Terraform configuration that deploys a Linux virtual machine
running Ubuntu 22.04 LTS, with 8 GB of RAM. The virtual machine should
be located in the West US region and assigned a public IP address.
It must be connected to a virtual network that includes a subnet and is
secured by a network security group.
Create a Terraform configuration for a Container App resource named
"myApp" using the quick start image. Set the container app environment name
to "awesomeAzureEnv" and the container name to "myQuickStartContainer".
Create a Terraform configuration for an Azure Databricks workspace named
"myworkspace" with the premium SKU. The workspace should be deployed in
the West US region.
Create a Terraform configuration for an Azure OpenAI deployment that uses
the "gpt-4" model. Specify the model version as "2024-05-01-preview" and
set the deployment name to "myOpenAIModel".
Tip
자세한 예제 프롬프트는 Azure에서 Microsoft Copilot를 사용하여 Terraform 및 Bicep 구성 생성을 참조하세요.