

Las traducciones son generadas a través de traducción automática. En caso de conflicto entre la traducción y la version original de inglés, prevalecerá la version en inglés.

# Definición de un proyecto de Terraform
<a name="tutorial-deploy-terraform-define"></a>

En este tutorial, definirá un proyecto de Terraform.

1. Cree un directorio denominado `my-pcluster-api`.

   Todos los archivos que cree estarán dentro de este directorio.

1. Cree el archivo `provider.tf` para configurar el AWS proveedor.

   ```
   provider "aws" {
     region  = var.region
     profile = var.profile
   }
   ```

1. Cree el archivo `main.tf` para definir los recursos mediante el 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"
     }
   }
   ```

1. Cree el archivo `variables.tf` para definir las variables que se pueden inyectar en este proyecto.

   ```
   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."
   }
   ```

1. Cree el archivo `terraform.tfvars` para establecer valores arbitrarios para las variables. 

   El siguiente archivo implementa una ParallelCluster API 3.11.1 `us-east-1` con el nombre de la pila. `MyParallelClusterAPI-3111` Podrás hacer referencia a esta implementación de ParallelCluster API usando su nombre de pila. 
**nota**  
La `api_version` asignación del siguiente código se puede reemplazar por cualquier AWS ParallelCluster versión compatible. 

   ```
   region = "us-east-1"
   api_stack_name = "MyParallelClusterAPI-3111"
   api_version = "3.11.1"
   ```

1. Cree el archivo `outputs.tf` para definir los resultados devueltos por este proyecto.

   ```
   output "pcluster_api_stack_outputs" {
     value = module.parallelcluster_pcluster_api.stack_outputs
   }
   ```

   El directorio del proyecto es el siguiente:

   ```
   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.
   ```