As traduções são geradas por tradução automática. Em caso de conflito entre o conteúdo da tradução e da versão original em inglês, a versão em inglês prevalecerá.
Definir um projeto Terraform
Neste tutorial, você definirá um projeto Terraform.
Crie um diretório denominado
my-pcluster-api.Todos os arquivos que você criar estarão dentro desse diretório.
Crie o arquivo
provider.tfpara configurar o AWS provedor.provider "aws" { region = var.region profile = var.profile }Crie o arquivo
main.tfpara definir os recursos usando o ParallelCluster módulo.module"parallelcluster_pcluster_api"{ source ="aws-tf/parallelcluster/aws//modules/pcluster_api"version ="1.1.0"region = var.region api_stack_name = var.api_stack_name api_version = var.api_version parameters = { EnableIamAdminAccess ="true"} }Crie o arquivo
variables.tfpara definir as variáveis que podem ser injetadas neste projeto.variable "region" { description = "The region the ParallelCluster API is deployed in." type = string default = "us-east-1" } variable "profile" { type = string description = "The AWS profile used to deploy the clusters." default = null } variable "api_stack_name" { type = string description = "The name of the CloudFormation stack used to deploy the ParallelCluster API." default = "ParallelCluster" } variable "api_version" { type = string description = "The version of the ParallelCluster API." }Crie o arquivo
terraform.tfvarspara definir valores arbitrários para as variáveis.O arquivo abaixo implanta uma ParallelCluster API 3.11.1
us-east-1usando o nome da pilha.MyParallelClusterAPI-3111Você poderá referenciar essa implantação de ParallelCluster API usando o nome da pilha.nota
A
api_versionatribuição no código a seguir pode ser substituída por qualquer AWS ParallelCluster versão compatível.region = "us-east-1" api_stack_name = "MyParallelClusterAPI-3111" api_version = "3.11.1"Crie o arquivo
outputs.tfpara definir os resultados gerados por esse projeto.output "pcluster_api_stack_outputs" { value = module.parallelcluster_pcluster_api.stack_outputs }O diretório do projeto é:
my-pcluster-api ├── main.tf - Terraform entrypoint to define the resources using the ParallelCluster module. ├── outputs.tf - Defines the outputs returned by Terraform. ├── providers.tf - Configures the AWS provider. ├── terraform.tfvars - Set the arbitrary values for the variables, i.e. region, PCAPI version, PCAPI stack name └── variables.tf - Defines the variables, e.g. region, PCAPI version, PCAPI stack name.