Dataset Viewer
Auto-converted to Parquet Duplicate
instruction
stringclasses
15 values
input
stringlengths
43
1.91k
output
stringlengths
77
27.9k
repo
stringlengths
9
119
license
stringclasses
12 values
file_path
stringlengths
5
187
provider_family
stringclasses
15 values
resource_types
listlengths
1
37
signature
stringlengths
32
32
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create an SSH key pair named `id_rsa` using the public key from the file path specified in the `key_path` variable, and launch a single t2.micro EC2 instance named `nginx-webserver` in the public subnet, using the AMI from the `ami` variable, associating it with the SSH key and a security group named `sgweb`, enabling ...
# Define SSH key pair for our instances resource "aws_key_pair" "nginx_key" { key_name = "id_rsa" public_key = "${file("${var.key_path}")}" } # Define webserver inside the public subnet resource "aws_instance" "nginx_wb" { ami = "${var.ami}" instance_type = "t2.micro" key_name = "${aws_key_pair.nginx_key...
dsenarathna/Automation
MIT
nginx-server/resources.tf
aws
[ "aws_instance", "aws_key_pair" ]
fa126a4074d33f0ba31aa42fe467e838
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create an S3 bucket with a randomly generated name, configure it to serve a static website using `index.html` as the index document and `error.html` as the custom error page, upload `index.html` and all `.jpg`, `.png`, and `.gif` files from the `assets` subdirectory into the bucket, and grant CloudFront read access to ...
resource "aws_s3_bucket" "website_bucket" { # Bucket Naming Rules #https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucketnamingrules.html?icmpid=docs_amazons3_console # we want to assign a random bucket name #bucket = var.bucket_name tags = { UserUuid = var.user_uuid } } # https://registry.terraf...
bmacharia/terraform-beginner-bootcamp-2023
MIT
modules/terrahome_aws/resource-storage.tf
aws
[ "aws_s3_bucket", "aws_s3_bucket_policy", "aws_s3_bucket_website_configuration", "aws_s3_object", "terraform_data" ]
da766631b7dea4040265c954d43ca4b2
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create an Application Load Balancer named with the pattern `<project-name>-alb-<environment>`, attach it to the provided subnet IDs, associate it with the designated security group, and tag it with the same name, the environment, and a Terraform marker set to true.
resource "aws_lb" "main" { # Name of the load balancer name = "${var.name}-alb-${var.environment}" load_balancer_type = "application" # Referencing the default subnets subnets = var.subnets # Referencing the security group security_groups = [aws_security_group.alb.id] t...
NicolaCostantino/Terragen
MIT
iaac/modules/terraform-aws-elb/load_balancers.tf
aws
[ "aws_lb" ]
1d4da5ec9c0d49c7023f96a6ee9a240f
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create an S3 bucket with a name derived from a configurable prefix, the current AWS account ID, and region, ensuring the name is between 3 and 63 characters; enable server-side encryption using either a specified KMS key or AES256, optionally enable versioning, and configure access logging to a designated bucket with p...
data "aws_caller_identity" "current" {} data "aws_region" "current" {} locals { current_region = data.aws_region.current.name current_account = data.aws_caller_identity.current.account_id bucket_name = var.use_default_naming_format ? format("%s-%s-%s", var.bucket_prefix, local.current_account, local.current...
HealthcareBlocks/hcblocks-terraform-modules-aws
Apache-2.0
s3_bucket/main.tf
aws
[ "aws_s3_bucket", "aws_s3_bucket_cors_configuration", "aws_s3_bucket_logging", "aws_s3_bucket_policy", "aws_s3_bucket_public_access_block", "aws_s3_bucket_server_side_encryption_configuration", "aws_s3_bucket_versioning" ]
33d3abf86e464d82c046e70e6cd860c6
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create a Cognito user pool named using the `user_pool_name` variable, a user pool client named using the `pool_client_name` variable associated with that pool, and a Cognito domain using the `dns_domain_name` variable linked to the same user pool.
resource "aws_cognito_user_pool" "user_pool" { name = var.user_pool_name } resource "aws_cognito_user_pool_client" "user_pool_client" { name = var.pool_client_name user_pool_id = aws_cognito_user_pool.user_pool.id } resource "aws_cognito...
khultman/Superalgos-IaC
Apache-2.0
tf/modules/platform/aws/Identity/Cognito/main.tf
aws
[ "aws_cognito_user_pool", "aws_cognito_user_pool_client", "aws_cognito_user_pool_domain" ]
c345bebb17a78120b619d23976d951d1
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create an S3 bucket named using the staging bucket variable, enable versioning, block all public access, configure a bucket policy that grants CloudFront read-only access only when the request originates from a specific CloudFront distribution, enable AES-256 server-side encryption, set lifecycle rules to delete noncur...
# S3 bucket for staging website content resource "aws_s3_bucket" "website_staging" { bucket = var.staging_bucket_name tags = merge( var.tags, { Name = "PythonCDMX Website Staging" Environment = "staging" } ) } # Enable versioning for staging bucket resource "aws_s3_bucket_versioni...
PythonMexico/pythonCDMX
MIT
terraform/s3-staging.tf
aws
[ "aws_s3_bucket", "aws_s3_bucket_cors_configuration", "aws_s3_bucket_lifecycle_configuration", "aws_s3_bucket_policy", "aws_s3_bucket_public_access_block", "aws_s3_bucket_server_side_encryption_configuration", "aws_s3_bucket_versioning" ]
668ed151b0e9e1d0694588b1a517074b
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create non-EKS subnets for each non-EKS subnet defined in `var.vpcConfig.subnets`, assigning each a public IP on launch, placing it in the specified availability zone, and tagging it with a name combining environment, location, common name, and subnet name. Separately, create EKS subnets for each subnet in `var.vpcConf...
resource "aws_subnet" "subnet" { for_each = { for subnet in var.vpcConfig.subnets : subnet.name => subnet if subnet.eksName == "" } vpc_id = aws_vpc.vpc.id cidr_block = each.value.cidr_block availability_zone = data.aws_availability_zones.available.names[each.va...
reddyavinash5/cloud-automation
MIT
aws/terraform/eks/tf-core-infra/subnet.tf
aws
[ "aws_subnet" ]
b76bfe0cd62406f1a27467ee87fb9a1e
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create an AWS Backup solution with two backup plans: one that replicates backups to a secondary region using a vault protected by a replica KMS key, and another that backs up only locally; configure an IAM role with the required AWS Backup service roles and permissions, and define backup selections based on configurabl...
provider "aws" { alias = "dr" region = var.dr_region } data "aws_caller_identity" "current" {} locals { account_id = data.aws_caller_identity.current.account_id backup_plan_ids = [ aws_backup_plan.this.id, aws_backup_plan.and_replicate.id ] } data "aws_iam_policy_document" "assume" { statement ...
rhythmictech/terraform-aws-backup
MIT
main.tf
aws
[ "aws_backup_plan", "aws_backup_selection", "aws_backup_vault", "aws_iam_role", "aws_iam_role_policy_attachment" ]
8d4771c4caddddd7501ba38b97c1959d
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create multiple security groups named using the environment and a key from the security_group variable, all associated with the specified VPC ID, and attach a set of inbound and outbound rules defined in local.rules—each rule specifying port ranges, protocol, CIDR blocks (IPv4 and IPv6), or source security group IDs—wh...
resource "aws_security_group" "sg" { for_each = var.security_group name = "${var.environment}-${each.key}-security-group" tags = { Name="${var.environment}-${each.key}-security-group" } vpc_id = var.vpc_id } resource "aws_security_group_rule" "rules" { count = length(local.rules) security_gr...
guruprasathselvaraj/terraform-3-tire-arch
MIT
modules/security_group/main.tf
aws
[ "aws_security_group", "aws_security_group_rule" ]
28b7e76f01d83b3d4e41f6c861b4f6aa
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create a standard network ACL in the us-east-1 region that allows all inbound and outbound traffic from any IP address, and associate it with the nine specific subnets: compute_a, compute_b, compute_c, compute_native_a, compute_native_b, compute_native_c, service_endpoint_a, service_endpoint_b, and service_endpoint_c.
resource "aws_network_acl" "standard" { provider = aws.use2 vpc_id = aws_vpc.main.id egress { rule_no = 100 protocol = "-1" action = "allow" cidr_block = "0.0.0.0/0" from_port = 0 to_port = 0 } ingress { rule_no = 100 protocol = "-1" action = "allo...
MyHealthCo/enterprise-services
BSD-3-Clause
k8s/ipv6/use2/network_acls.tf
aws
[ "aws_network_acl", "aws_network_acl_association" ]
6933674e2c336e9fca00e4c4b89eaae5
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create an application load balancer named “whiz-alb” in the default VPC across us-east-1a and us-east-1b subnets, with an HTTP listener on port 80 forwarding traffic to a target group named “whiz-tg” that health-checks instances every 10 seconds at the root path. Launch two t2.micro EC2 instances using AMI ami-01cc34ab...
provider "aws" { region = "${var.region}" access_key = "${var.access_key}" secret_key = "${var.secret_key}" } ############ Creating Security Group for EC2 & ELB ############ resource "aws_security_group" "web-server" { name = "web-server" description = "Allow incoming HTTP Connections...
hibachouchou/Create-an-Application-Load-Balancer---incoming-traffic--EC2-Instances--Terraform
MIT
main.tf
aws
[ "aws_instance", "aws_lb", "aws_lb_listener", "aws_lb_target_group", "aws_lb_target_group_attachment", "aws_security_group" ]
7c6d38b970d4865c5eba16923193f808
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create a VPC with a configurable CIDR block, DNS support, and DNS hostnames enabled, along with public, private, database, and control plane subnets distributed across availability zones, including an internet gateway and a single NAT gateway in the first public subnet to enable outbound internet access for private res...
# Copyright © 2021-2024, SAS Institute Inc., Cary, NC, USA. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 # This is customized based on - https://github.com/terraform-aws-modules/terraform-aws-vpc locals { vpc_id = var.vpc_id == null ? aws_vpc.vpc[0].id : data.aws_vpc.vpc[0].id existing_sub...
navarro-chamberlain/viya4
Apache-2.0
modules/aws_vpc/main.tf
aws
[ "aws_db_subnet_group", "aws_eip", "aws_internet_gateway", "aws_nat_gateway", "aws_route", "aws_route_table", "aws_route_table_association", "aws_subnet", "aws_vpc", "aws_vpc_endpoint" ]
a0e93625173abdb7d48e0cbca939fa07
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create an Application Load Balancer listener rule that routes traffic based on optional host header and path pattern conditions, supporting forward, redirect, fixed-response, Cognito authentication, OIDC authentication, and weighted forward actions with optional stickiness, using the provided listener ARN and priority.
resource "aws_lb_listener_rule" "this" { listener_arn = var.listener_arn priority = var.priority dynamic "condition" { for_each = length(var.alb_hosts) > 0 ? [1] : [] content { host_header { values = var.alb_hosts } } } dynamic "condition" { for_each = length(var.alb_...
chiwooiac/tfmodule-aws-alb
MIT
modules/rule/main.tf
aws
[ "aws_lb_listener_rule" ]
68bcadc32f876ddd716a0e8582abfa8d
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create a Lambda function named AWSAlertValidationErrorAlarm using Python 3.12, packaged from ErrorAlarm.py, with a 30-second timeout and tagged for monitoring; provision an IAM role allowing it to assume the Lambda execution role and write logs to CloudWatch with a 30-day retention period for the function’s log group.
data "archive_file" "error_alarm_zip" { type = "zip" source_file = "${path.module}/ErrorAlarm.py" output_path = "${path.module}/ErrorAlarm.zip" } resource "aws_lambda_function" "error_alarm" { filename = data.archive_file.error_alarm_zip.output_path function_name = "AWSAlertValidationErrorAlarm" ...
JBVK/AWSAlertValidation
MIT
Lambda/ErrorAlarm/main.tf
aws
[ "aws_cloudwatch_log_group", "aws_iam_role", "aws_iam_role_policy", "aws_lambda_function" ]
348a1bc97893067394ea3a24ea55e083
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Deploy the Argo CD Helm chart into a new `argocd` namespace, configure its server to expose a LoadBalancer service with an insecure HTTP endpoint, enable an ALB ingress with internet-facing scheme, IP target type, and root-path health checks, set the admin password to the bcrypt hash of `AdminPassword123!`, enable Appl...
resource "helm_release" "argocd" { name = "argocd" repository = "https://argoproj.github.io/argo-helm" chart = "argo-cd" namespace = "argocd" create_namespace = true set = [ { name = "server.service.type" value = "LoadBalancer" }, { name =...
ewsffg/terraform-eks
MIT
modules/argocd/helm.tf
k8s
[ "helm_release", "kubernetes_namespace" ]
5b4a3e845209a120d8a0e98fa8c07e2f
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create an S3 bucket with the name provided via `bucket_name`, configure it to host a static website using `index.html` as the index and `error.html` as the error page, enable public read access to all objects in the bucket by setting the ACL to `public-read`, disable all public access blocking controls, and ensure the ...
resource "aws_s3_bucket" "s3_bucket" { bucket = var.bucket_name tags = var.bucket_tags force_destroy = true #allows to destroy bucket even if it is not empty } data "aws_iam_policy_document" "s3_read_permissions-website" { statement { effect = "Allow" principals { type = "*" identi...
hemant-technerd/terraform-aws-s3-website
Apache-2.0
main.tf
aws
[ "aws_s3_bucket", "aws_s3_bucket_acl", "aws_s3_bucket_ownership_controls", "aws_s3_bucket_policy", "aws_s3_bucket_public_access_block", "aws_s3_bucket_website_configuration" ]
f5faf920a6ecc59c287495a0fbd72d32
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create a private S3 bucket with the name specified by the `bucket_name` variable, enforce that all access requires secure transport (HTTPS), block all public access at the bucket and account level, enable server-side encryption using the AWS managed KMS key for S3, and configure versioning according to the `bucket_vers...
data "aws_iam_policy_document" "this" { source_policy_documents = [var.policy] statement { sid = "DenyInsecureTransport" actions = ["s3:*"] effect = "Deny" principals { type = "*" identifiers = ["*"] } resources = ["arn:aws:s3:::${var.bucket_name}/*"] condition {...
woffenden/infrastructure
MIT
terraform/modules/aws/s3/modules/private-bucket/main.tf
aws
[ "aws_s3_bucket", "aws_s3_bucket_acl", "aws_s3_bucket_policy", "aws_s3_bucket_public_access_block", "aws_s3_bucket_server_side_encryption_configuration", "aws_s3_bucket_versioning" ]
19cf6bb2f427ea9e24e74dd6b7b16633
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create an API Gateway v2 custom domain name using the domain specified in `var.apigatewayv2_domain_name_domain_name`, configure its TLS certificate and endpoint type via `var.apigatewayv2_domain_name_domain_name_configuration`, optionally enable mutual TLS authentication using a truststore from `var.apigatewayv2_domain...
#--------------------------------------------------- # AWS API Gateway v2 domain name #--------------------------------------------------- resource "aws_apigatewayv2_domain_name" "apigatewayv2_domain_name" { count = var.enable_apigatewayv2_domain_name ? 1 : 0 domain_name = var.apigatewayv2_domain_name_domain_name ...
SebastianUA/terraform
Apache-2.0
aws/modules/apigatewayv2/apigatewayv2_domain_name.tf
aws
[ "aws_apigatewayv2_domain_name" ]
966a0edcdc64e3c4b1dd76c7ddc5e91d
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create an EC2 instance of type t2.micro using AMI ami-0e37e42dff65024ae, attach it to the public subnet from the remote VPC state, assign it a public IP, enable detailed CloudWatch monitoring, associate it with the ECS instance profile from remote IAM state, provision 30 GiB of gp2 storage as its root volume, and confi...
resource "aws_security_group" "instance" { name = "instance" description = "instance sg" vpc_id = data.terraform_remote_state.vpc.outputs.vpc_id egress { from_port = 0 to_port = 0 protocol = "-1" cidr_blocks = ["0.0.0.0/0"] } } resource "aws_instance" "instance" { ami ...
sunakan/erapp
MIT
terraform/service/main.tf
aws
[ "aws_instance", "aws_security_group" ]
6361bbfbc73439a758d6fcff6527587c
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create an AWS VPC endpoint for the API Gateway service in the current region, configured as an interface endpoint, with private DNS resolution enabled, and only when the deployment flag is set to true.
data "aws_region" "current" {} resource "aws_vpc_endpoint" "private_api_gateway" { count = var.api_gateway_vpc_endpoint_deployment ? 1 : 0 service_name = "cn.com.amazonaws.${data.aws_region.current.name}.execute-api" vpc_endpoint_type = "Interface" vpc_id = var.vpc_id subnet_ids ...
camillehe1992/terraform-cicd-pipeline-github-actions
Apache-2.0
terraform/modules/vpc_endpoint/endpoints.tf
aws
[ "aws_vpc_endpoint" ]
75684feae37aac97e78bab07b661e70b
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create a Cognito user pool named using the `pool_name` variable, and configure a client named "API_Example_Key" attached to it that permits password-based authentication, SRP-based authentication, and refresh token usage.
resource "aws_cognito_user_pool" "api_pool" { name = var.pool_name } resource "aws_cognito_user_pool_client" "api_client" { name = "API_Example_Key" user_pool_id = aws_cognito_user_pool.api_pool.id explicit_auth_flows = [ "ALLOW_USER_PASSWORD_AUTH", "ALLOW_USER_SRP_AUTH", "ALLOW_REFRESH_TOK...
srinivas-pradhan/api_implementation
MIT
modules/api_example/cognito.tf
aws
[ "aws_cognito_user_pool", "aws_cognito_user_pool_client" ]
caf114911f64eb32be8f7c9307fc5061
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create three sets of subnets in the specified VPC: public subnets with one per availability zone, each assigned a CIDR block from `var.public_subnet_cidrs`, configured to automatically assign public IP addresses on launch, and named with the app name, “public”, and the availability zone; private subnets, also one per a...
locals { public_subnets = [ for i, cidr in var.public_subnet_cidrs : { cidr_block = cidr availability_zone = element(var.availability_zones, i % length(var.availability_zones)) } ] private_subnets = [ for i, cidr in var.private_subnet_cidrs : { cidr_block = cidr ...
wwwtskt/tfmodule
MIT
aws/network/subnet/main.tf
aws
[ "aws_subnet" ]
1fe285ac80759efbd9524d3af7b0ec6c
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Provision a configurable number of EC2 instances across available availability zones, each using a specified AMI, instance type, and user data script, with optional key pair, detailed monitoring, and security groups; attach a root EBS volume and additional EBS volumes with customizable size, type, encryption, and IOPS,...
data "aws_availability_zones" "this" { state = "available" } resource "aws_instance" "this" { count = var.instance_count ami = var.ami instance_type = var.instance_type user_data = var.user_data key_name = var.key_name monitoring = var.m...
dikaeinstein/cloud-devops-engineer
MIT
ec2/main.tf
aws
[ "aws_instance" ]
16b9ab4509cf56d3546346492adf699e
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create an IAM role named “bedrock-bastion-instance” that EC2 instances can assume, attach the AWS managed policies for SSM and CloudWatch Agent to that role.
data "aws_iam_policy_document" "ec2_assume_role_policy" { statement { actions = ["sts:AssumeRole"] principals { identifiers = ["ec2.amazonaws.com"] type = "Service" } } } resource "aws_iam_role" "bastion_instance" { name = "bedrock-bastion-instance" assume_role_pol...
figurate/bedrock
MIT
roles/bastion/aws/instance_profile.tf
aws
[ "aws_iam_role", "aws_iam_role_policy_attachment" ]
4d7061c82ce718d217c121bdad1e8cce
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Request an ACM certificate in the US East (N. Virginia) region for the root domain and all domains listed in the subject alternative names variable, using DNS validation; create a Route 53 validation record for each domain validation option with a TTL of 60 seconds, placing them in the hosted zone specified by the host...
resource "aws_acm_certificate" "cert" { provider = aws.virginia domain_name = var.root_domain_name subject_alternative_names = var.subject_alternative_names validation_method = "DNS" } resource "aws_route53_record" "cert_validations" { count = length(var.subject_alternative_names) zone_id = local.zone_not...
senter7/Terraform-Online-Static-Website
Apache-2.0
modules/website/certificate.tf
aws
[ "aws_acm_certificate", "aws_acm_certificate_validation", "aws_route53_record" ]
0d0cf232a8a3ecd67b9d8920fca3b611
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create an OIDC identity provider in AWS for GitHub Actions using a specified URL and TLS certificate thumbprints, then create an IAM role named via a variable that allows GitHub Actions to assume it via web identity, with conditions restricting access to specific repositories and the AWS STS audience, attach a list of ...
terraform { required_providers { aws = { source = "hashicorp/aws" } tls = { source = "hashicorp/tls" } } } # Data source to fetch AWS caller identity data "aws_caller_identity" "current" {} # Data source to fetch AWS partition (e.g., aws, aws-cn) data "aws_partition" "current" {} d...
srajasimman/terraform-aws-github-oidc-iam
MIT
main.tf
aws
[ "aws_iam_openid_connect_provider", "aws_iam_policy", "aws_iam_role", "aws_iam_role_policy_attachment" ]
6ef8c6a098320468293d3579952745ad
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create a default VPC with CIDR 10.0.0.0/16 for a Limble assessment, including two public subnets (10.0.0.0/20 and 10.0.16.0/20) connected to an internet gateway and a public route table, and two private subnets (10.0.128.0/20 and 10.0.144.0/20) with NAT gateway access via a single Elastic IP in the first public subnet ...
data "aws_availability_zones" "available" {} # default vpc for Limble assessment resource "aws_vpc" "default" { cidr_block = "10.0.0.0/16" tags = { Name = "${var.name}-vpc" assessment = var.name } } # public subnet 1 resource "aws_subnet" "public_subnet_1" { vpc_id = aws_vpc.default.id ci...
Mhart12/limble-assessment
MIT
aws_resources/vpc/main.tf
aws
[ "aws_eip", "aws_internet_gateway", "aws_nat_gateway", "aws_route_table", "aws_route_table_association", "aws_subnet", "aws_vpc" ]
844faf7e4e00681f942f5a8ec50cb428
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create an ECS cluster with a configurable name, enable or disable CloudWatch Container Insights based on a variable, and optionally configure capacity providers—including a default capacity provider strategy with weighted targets and base counts—if any are provided.
# ----------------------------------------------------------------------------- # ECS Cluster Module # Creates a shared ECS cluster that can host multiple services # ----------------------------------------------------------------------------- terraform { required_providers { aws = { source = "hashicorp/...
llamandcoco/infra-modules
MIT
terraform/ecs-cluster/main.tf
aws
[ "aws_ecs_cluster", "aws_ecs_cluster_capacity_providers" ]
a7a10b517b99f3a90a7dd748875ae7a5
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Provision one t2.micro EC2 instance in the California region using AMI ami-03130878b60947df3, and provision one t2.micro EC2 instance in the Oregon region using AMI ami-0a36eb8fadc976275.
/* Staus of this template : Run perfect */ resource "aws_instance" "testVM_California" { provider = aws.California ami = "ami-03130878b60947df3" instance_type = "t2.micro" count = 1 } resource "aws_instance" "testVM_Oregon" { provider = aws.Oregon ami = "ami-0a36eb8fadc976275" instance_...
arnathan2k/terraform-samples
Apache-2.0
01-01-create-vms/main.tf
aws
[ "aws_instance" ]
e386c4a805b8ba1f90b5049d333a3fbc
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Provision an OpenSearch domain with the specified name and engine version, enabled with internal user database and master credentials from a secret, node-to-node and at-rest encryption, HTTPS-only endpoints using TLS 1.0 or higher, a cluster with the given instance count and type, zone awareness enabled when more than ...
resource "aws_opensearch_domain" "opensearch" { count = var.opensearch.enable ? 1 : 0 domain_name = var.opensearch.domain_name engine_version = var.opensearch.engine_version advanced_security_options { enabled = true internal_user_database_enabled = true master_use...
dspace-group/dspace-reference-architecture-aws
MIT
modules/ivs_aws_instance/opensearch.tf
k8s
[ "aws_opensearch_domain" ]
13e7ed6d9bbfd0a16e76d89232a330fc
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create an S3 bucket named `s3-logs-` followed by a random six-character lowercase alphanumeric suffix to serve as a centralized logging destination. For each pipeline in `local.safe_codepipeline_pipelines`, create a uniquely suffixed S3 bucket named `pipeline-artifacts-<pipeline-name>-<four-character-random-suffix>` wi...
# Instructions: Create resources for S3 resource "random_string" "suffix" { length = 6 upper = false special = false } resource "aws_s3_bucket" "logging_bucket" { bucket = "s3-logs-${random_string.suffix.result}" } resource "random_string" "codepipeline_artifacts_s3_buckets" { for_each = local.safe_code...
joeycloudio/module-aws-tf-cicd
MIT
s3.tf
aws
[ "aws_s3_bucket", "aws_s3_bucket_lifecycle_configuration", "aws_s3_bucket_logging", "aws_s3_bucket_public_access_block", "aws_s3_bucket_server_side_encryption_configuration", "aws_s3_bucket_versioning", "random_string" ]
4fb106d4deb49f5325030e8b2dc89f42
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create one or more load balancer target groups based on a variable list, each configured with a VPC ID, backend port and protocol (converted to uppercase), optional target type, deregistration delay, slow start duration, proxy protocol v2, and lambda multi-value headers; each target group should support custom health c...
resource "aws_lb_target_group" "main" { count = var.create_tg ? length(var.target_groups) : 0 name = lookup(var.target_groups[count.index], "name", null) name_prefix = lookup(var.target_groups[count.index], "name_prefix", null) vpc_id = var.vpc_id port = lookup(var.target_groups[count.in...
miraiadvisory/terraform-aws-alb-tg
Apache-2.0
main.tf
aws
[ "aws_lb_target_group", "aws_lb_target_group_attachment" ]
f169f5b1eba2b0a1d8c6a05975c609a2
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create a Route 53 A record for the fully qualified domain name formed by appending a dot to the value of `dns_name_tfe`, pointing to the public IP address stored in `tfe_instance_public_ip`, with a TTL of 300 seconds, in the Route 53 hosted zone whose name is provided via `dns_zone_name`.
data "aws_route53_zone" "zone" { name = var.dns_zone_name } resource "aws_route53_record" "www" { zone_id = data.aws_route53_zone.zone.zone_id name = "${var.dns_name_tfe}." type = "A" ttl = "300" records = [var.tfe_instance_public_ip] }
berchev/ptfe-airgap-automated
MIT
modules/r53/dns_record.tf
aws
[ "aws_route53_record" ]
778c27139e6d6e90347f9bf45843651c
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create an IAM role named “DataIngressServer” that ECS tasks can assume, attach a policy granting it permissions to pull container images from a specific ECR repository, decrypt data using a designated KMS key, read configuration objects from a specific S3 bucket and list the bucket, export and retrieve a specific ACM c...
data "aws_iam_policy_document" "sft_agent_task" { statement { sid = "PullIngressSFTAgentImageECRrepository" actions = [ "ecr:BatchCheckLayerAvailability", "ecr:GetDownloadUrlForLayer", "ecr:BatchGetImage", ] resources = ["arn:aws:ecr:${var.region}:${var.account[var.management_accoun...
dwp/dataworks-aws-data-ingress
ISC
terraform/data-ingress-sft-task/sft_agent_iam.tf
aws
[ "aws_iam_policy", "aws_iam_role", "aws_iam_role_policy_attachment" ]
da80417135874432192ee297158a84de
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create four CodeCommit repositories named avbank_web, avbank_transactions, avbank_accounts, and avbank_discounts with descriptions indicating they serve as the web tier app and the transactions, accounts, and discounts services respectively for the AvailableBank project.
terraform { required_providers { aws = { source = "hashicorp/aws" } } } resource "aws_codecommit_repository" "avbank_web_repo" { repository_name = "avbank_web" description = "Web tier app for the AvailableBank project" } resource "aws_codecommit_repository" "avbank_transactions_repo" { re...
tomasz-grzesiak/HighAvailabilityOnAWS
MIT
modules/repositories/main.tf
aws
[ "aws_codecommit_repository" ]
a5d28d537195e0f478451492688bf4dd
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Store the ARN of the load balancer and the ARN of its main listener as SSM parameters under the path `/project-name/ecs/alb_arn` and `/project-name/ecs/alb_listener` respectively, using the String parameter type.
resource "aws_ssm_parameter" "lb_arn" { name = format("/%s/ecs/alb_arn", var.project_name) type = "String" value = aws_lb.main.arn } resource "aws_ssm_parameter" "lb_listener" { name = format("/%s/ecs/alb_listener", var.project_name) type = "String" value = aws_lb_listener.main.arn }
pmmenezes/terraform-ecs-cluster
MIT
parameters_store.tf
aws
[ "aws_ssm_parameter" ]
4531cb7835121d9e90181a97e1d0e9d4
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create an internet-facing Application Load Balancer named according to the `name` variable, deployed across the subnets specified in the `subnets` variable, and secured with a security group named `<name>-dmz` that permits inbound HTTPS (port 443) and HTTP (port 80) traffic from anywhere (0.0.0.0/0) and allows all outb...
resource "aws_lb" "alb" { name = var.name internal = false load_balancer_type = "application" security_groups = [aws_security_group.webdmz.id] subnets = var.subnets tags = { Provisioner = "terraform" Environment = var.environment } } resource "aws_security_g...
ljossha/terraform-simple-app
Apache-2.0
modules/alb/main.tf
aws
[ "aws_lb", "aws_security_group" ]
0afd1e265c6a90ff5ae3c5a8fdd6d342
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create two ECR repositories named after the project—`<project_name>-api` and `<project_name>-nginx`—both configured to allow mutable image tags and automatically scan images on push; for each repository, enforce a lifecycle policy that retains only the 10 most recent images and expires older ones.
resource "aws_ecr_repository" "api" { name = "${var.project_name}-api" image_tag_mutability = "MUTABLE" image_scanning_configuration { scan_on_push = true } } resource "aws_ecr_lifecycle_policy" "api" { repository = aws_ecr_repository.api.name policy = jsonencode({ rules = [ ...
heschmat/ultimate-terraform-aws
BSD-3-Clause
setup/ecr.tf
aws
[ "aws_ecr_lifecycle_policy", "aws_ecr_repository" ]
c6a8b762b738db54e27f54461b7cbe17
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create a placement group with the name and strategy specified by variables, and an Auto Scaling group named after the variable `name`, using the given minimum, maximum, and desired capacity values, with a 300-second cooldown and health check grace period, health checks based on EC2 status, instances launched into the p...
resource "aws_placement_group" "main" { name = var.name strategy = var.placement_group tags = var.tags } resource "aws_autoscaling_group" "main" { name = var.name default_cooldown = 300 desired_capacity = var.scaling_config.min_size force_delete ...
ben-x/cloudpedia
MIT-0
content/common-modules/aws-ec2-fleet/asg.tf
aws
[ "aws_autoscaling_group", "aws_placement_group" ]
0ea5b733b0e22aa91155253d5b4e39ae
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Provision an SSL/TLS certificate for a subdomain of jordibru.cloud, using DNS validation, and ensure it’s issued in the us-east-1 region; automatically create the necessary DNS validation records in the jordibru.cloud hosted zone with a 60-second TTL and overwrite any existing records with the same name and type.
data "aws_route53_zone" "jordibru_cloud" { name = "jordibru.cloud" } resource "aws_acm_certificate" "domain_certificate" { domain_name = "${var.subdomain}.jordibru.cloud" validation_method = "DNS" lifecycle { create_before_destroy = true } provider = aws.us-east-1-acm tags = { terraform ...
JordiiBru/aws-acm
MIT
main.tf
aws
[ "aws_acm_certificate", "aws_acm_certificate_validation", "aws_route53_record" ]
21fdca111960ac1257eb5469de9af0c8
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create a CodeBuild project named after the Lambda function with deployment suffix, configured to pull source from CodePipeline, use a specified IAM role or a newly created one, enable CloudWatch Logs with a retention period defined by a variable, disable S3 logs, set the build environment with Python 3.9 runtime and cu...
resource "aws_cloudwatch_log_group" "this" { name = "/aws/codebuild/${var.function_name}-deployment" retention_in_days = var.codebuild_cloudwatch_logs_retention_in_days tags = var.tags } resource "aws_codebuild_project" "this" { name = "${var.function_name}-deployment" servi...
willsc/terraform-lambda
MIT
modules/deployment/codebuild.tf
aws
[ "aws_cloudwatch_log_group", "aws_codebuild_project" ]
cbea4b60e412efac9a404f8880fd4e2f
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create one EC2 instance per VPC defined in the `vpcs` variable, each using AMI `ami-0599b6e53ca798bb2`, placed in the corresponding subnet, sized as `t2.micro`, assigned a static private IP from the VPC’s configuration, tagged with a name combining the project name and its index, and attached to an IAM instance profile...
resource "aws_instance" "instances" { count = length(var.vpcs) ami = "ami-0599b6e53ca798bb2" subnet_id = aws_subnet.subnets[count.index].id instance_type = "t2.micro" iam_instance_profile = aws_iam_instance_profile.ssm_managed.name private_ip = var...
Hasuzawa/aws-projects
MIT
aws/09-vpc-peering-transit-gateway/instance.tf
aws
[ "aws_instance" ]
f60100cd23197f993172c91765d37d31
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create a single EC2 instance named `<prefix>-app-server` with role Web-Server, using the specified AMI ID, instance type, subnet, key pair, and security group, and apply common tags to it.
# modules/aws_vm/main.tf # Creates a single AWS EC2 instance. resource "aws_instance" "app_server" { ami = var.ami_id instance_type = var.instance_type subnet_id = var.subnet_id key_name = var.key_name vpc_security_group_ids = [var.security_group_id] ...
Abdulrahman-A-Muhammad/terraform-multicloud
MIT
modules/aws_vm/main.tf
aws
[ "aws_instance" ]
877488a709f76981c8065b0f1a605d7a
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create three VPCs named prod, nonprod, and shared in the us-east-2 region, with CIDR blocks 10.254.0.0/16, 10.253.0.0/16, and 10.255.0.0/16 respectively, each enabling DNS hostnames and tagged with their names. Provision private subnets in prod and nonprod across all available Availability Zones, and public subnets in ...
provider "aws" { region = "us-east-2" } data "aws_region" "current" {} resource "aws_vpc" "prod" { cidr_block = "10.254.0.0/16" enable_dns_hostnames = true tags = { Name = "prod" } } resource "aws_vpc" "nonprod" { cidr_block = "10.253.0.0/16" enable_dns_hostnames = true tags...
mannbiher/aws-eks-lab
MIT
infrastructure/network/main.tf
aws
[ "aws_internet_gateway", "aws_main_route_table_association", "aws_route_table", "aws_subnet", "aws_vpc", "aws_vpc_peering_connection", "aws_vpc_peering_connection_options" ]
d133fd85732838afa14664bf9b99780b
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create a VPC with a single public subnet, an internet gateway attached to the VPC, and a route table that directs all traffic (0.0.0.0/0) to the internet gateway; associate the subnet with the route table. Configure a security group that allows inbound SSH (port 22), HTTPS (port 443), Consul (port 8500), Serf LAN (port...
# create the VPC resource "aws_vpc" "vpc" { cidr_block = var.vpcCIDRblock instance_tenancy = var.instanceTenancy enable_dns_support = var.dnsSupport enable_dns_hostnames = var.dnsHostNames tags = { Name = "VPC_${var.vpc_name}" } } # end resource # create the subnet resource "aws_subnet...
chavo1/aws-vpc-terraform
MIT
vpc.tf
aws
[ "aws_internet_gateway", "aws_network_acl", "aws_route_table", "aws_route_table_association", "aws_security_group", "aws_subnet", "aws_vpc" ]
68aaadc1916c84d497e8f35a2ec4a500
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create a security group in the specified VPC with a name derived from a variable, allow SSH access on port 22 from a configurable set of CIDR blocks, permit HTTP on port 80 and HTTPS on port 443 from their respective configurable CIDR blocks, add one or more custom data port rules on port 8080 based on a list of CIDR b...
resource "aws_security_group" "main" { name_prefix = var.security_group_name vpc_id = var.vpc_id ingress { from_port = 22 to_port = 22 protocol = "tcp" cidr_blocks = var.ssh_cidr_blocks description = "SSH access" } ingress { from_port = 80 to_port = 80 pro...
Asiwomex/Terraform-project-aws
MIT
modules/security_group/main.tf
aws
[ "aws_security_group" ]
564b8461d0428164b83c38e04ed22e4e
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Set up logging for a WAFv2 web ACL by sending its logs to a Kinesis Firehose delivery stream that delivers them to an S3 bucket, with the Firehose stream named using the web ACL’s name and configured to store logs under a CloudFront-specific prefix in the bucket.
resource "aws_wafv2_web_acl_logging_configuration" "wafv2_logging_configuration" { log_destination_configs = [aws_kinesis_firehose_delivery_stream.wafv2_logging_firehose_stream.arn] resource_arn = var.web_acl_arn } resource "aws_kinesis_firehose_delivery_stream" "wafv2_logging_firehose_stream" { name...
KayakinCoder/filmdrop-learn
Apache-2.0
modules/cloudfront/waf_qp_bytematch/log_configuration/kinesis_log_configuration.tf
aws
[ "aws_kinesis_firehose_delivery_stream", "aws_wafv2_web_acl_logging_configuration" ]
7ab5cb391f76447282e656e96f752987
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create a snapshot volume permission that grants a specific AWS account access to restore from a given snapshot in a designated region.
resource "aws_snapshot_create_volume_permission" "this" { region = var.region snapshot_id = var.snapshot_id account_id = var.account_id }
ebogdum/terraform-providers
MIT
aws/resources/snapshot_create_volume_permission/main.tf
aws
[ "aws_snapshot_create_volume_permission" ]
9bb83609aef0a1575473829969d3642b
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create an IAM role named with the resource prefix followed by `-ec2-github-runner` that allows EC2 instances to assume it, attach the AWS managed policy `AmazonSSMManagedInstanceCore` to it, and create a matching IAM instance profile with the same name and a tag `Name` set to `AWS EC2 Github runner instance profile`.
resource "aws_iam_role" "ec2_github_runner" { name = "${var.resource_prefix}-ec2-github-runner" managed_policy_arns = [ "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore", ] assume_role_policy = data.aws_iam_policy_document.ec2_assume_role.json } resource "aws_iam_instance_profile" "ec2_github_runner" ...
QuiNovas/terraform-aws-ec2-github-runner
Apache-2.0
role.tf
aws
[ "aws_iam_instance_profile", "aws_iam_role" ]
485fcb4ed8f9e4f8c047f853d8a316cb
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create a security group named “allow_rdp” that permits inbound RDP traffic on TCP port 3389 from any IP address, and allow all outbound traffic to any destination. Tag the security group with the name “allow_rdp_sg”.
# define security group to allow rdp access resource "aws_security_group" "allow_rdp" { name = "allow_rdp" ingress { from_port = 3389 to_port = 3389 protocol = "tcp" cidr_blocks = ["0.0.0.0/0"] } egress { from_port = 0 to_port = 0 protocol = "-1" cidr_blocks = ...
inderpal2406/terraform_assignment
MIT
sg.tf
aws
[ "aws_security_group" ]
53e523943bda603c43826d453218fac9
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Deploy a single-container ECS Fargate service named after the project and environment, running in two public subnets across Availability Zones with automatic public IP assignment, allowing port 5000 traffic via a designated security group, using standard ECS rolling deployments with 50% minimum and 200% maximum healthy...
# ------------------------------------------------------------------------------ # ECS Fargate Service # This defines how the task will be deployed and run across subnets and AZs # ------------------------------------------------------------------------------ resource "aws_ecs_service" "app" { name = "${v...
lyn-boyu/aws-dev-ops
MIT
apps/flask-api-ecs-terraform/terraform/service.tf
aws
[ "aws_ecs_service" ]
d09b5eec4bb1b676c42effedc50028e4
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create a TCP load balancer target group named with the provided name and port, attach multiple targets from the given list to it on the specified port, and configure a TCP listener on the provided load balancer to forward traffic to that target group.
resource "aws_lb_target_group" "aws_lb_target_group" { name = "${var.name}-target-group-${var.port}" port = var.port protocol = "TCP" vpc_id = var.vpc_id tags = var.tags } resource "aws_lb_target_group_attachment" "aws_lb_target_group_attachment" { count = length(var.target_id) #for_e...
kunalb19/terraform-aws-create-elb
Apache-2.0
main.tf
aws
[ "aws_lb_listener", "aws_lb_target_group", "aws_lb_target_group_attachment" ]
544c853a9d5cb44e5d773d9b500974ed
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create a Service Catalog tag option with a configurable key, value, and region, set to active or inactive as specified, and define custom timeouts for create, read, update, and delete operations using the provided variable values.
resource "aws_servicecatalog_tag_option" "this" { key = var.key value = var.value region = var.region active = var.active timeouts { create = var.timeouts.create read = var.timeouts.read update = var.timeouts.update delete = var.timeouts.delete } }
ebogdum/terraform-providers
MIT
aws/resources/servicecatalog_tag_option/main.tf
aws
[ "aws_servicecatalog_tag_option" ]
787fab2a097f5e117b6cdfaf27f52291
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create an S3 bucket named with the domain suffix “-redirect”, configured to redirect all requests to the HTTPS version of the domain, with private access and automatic deletion on destroy. Set up a CloudFront distribution with the domain alias pointing to that bucket, using an ACM certificate for TLS 1.2 or higher, HTT...
locals { s3_redirect_origin_id = "s3-redirect-${var.base_name}" } ########## S3 bucket ########## resource "aws_s3_bucket" "redirect" { bucket = "${var.domain}-redirect" acl = "private" force_destroy = true website { redirect_all_requests_to = "https://${var.domain}" } tags = { ...
bridgecrew-perf4/terraform-modules-65
MIT
modules/staticsite/cfredirect.tf
aws
[ "aws_cloudfront_distribution", "aws_s3_bucket" ]
fca20e7d15a5aef8c80dc9eb8e4669d9
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create a public route table in the specified VPC that routes all internet-bound traffic (0.0.0.0/0) through the internet gateway, and tag it with the project name as both the Name and Project tags.
resource "aws_route_table" "route-table-pub" { vpc_id = aws_vpc.vpc.id route { cidr_block = "0.0.0.0/0" gateway_id = aws_internet_gateway.internet-gateway.id } tags = merge( var.tags, { Name = "${var.project_name}-route-table-pub" Project = "${var.project_name}" } ) }
thdesous/aws-eks-cluster
MIT
infra/modules/network/route-table-public.tf
aws
[ "aws_route_table" ]
2dc1aee087b770c962e142ae3e045075
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create a security group named after the bastion instance variable, attached to the specified VPC, with a description that includes the bastion name and tags the group with the same name; allow all outbound traffic to any IPv4 and IPv6 destination.
resource "aws_security_group" "bastion_group" { name = var.bastion_name description = "${var.bastion_name} ec2 instance security group" vpc_id = var.vpc_id tags = { Name = var.bastion_name } } resource "aws_security_group_rule" "outbound" { from_port = 0 protocol = "-1" security_group_id = aws_sec...
jwa-lab/terraform-aws-vpc-bastion
Apache-2.0
security.tf
aws
[ "aws_security_group", "aws_security_group_rule" ]
4cebadbed76bad2fb169e0c8836674e2
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create an ECR repository named after the short project name with immutable image tags, encrypted using the specified KMS key alias, with image scanning enabled on push, and set a lifecycle policy to automatically expire untagged images older than seven days.
data "aws_kms_key" "ecr_kms_key" { key_id = "alias/${var.general_kms_key_alias}" # Replace with your KMS key alias } resource "aws_ecr_repository" "main" { name = "${var.short_project_name}-repo" image_tag_mutability = "IMMUTABLE" encryption_configuration { encryption_type = "KMS" kms_...
ogbrown/ogb-ecr-tf-proj
MIT
modules/ecr/main.tf
aws
[ "aws_ecr_lifecycle_policy", "aws_ecr_repository" ]
2c617f29db3be50a19d16238a3056799
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create a CloudFront distribution for the main domain that serves static content from an S3 bucket using Origin Access Control, optionally routes API traffic to an API Gateway endpoint, supports custom origins with configurable headers and protocols, enforces HTTPS with TLS 1.2 minimum, uses ACM certificate validation f...
locals { s3_origin_id = var.cf_website_origin_id != "" ? var.cf_website_origin_id : "S3Website-${local.resolved_bucket_name}" lambda_origin_id = var.cf_lambda_origin_id != "" ? var.cf_lambda_origin_id : "Lambda-${local.resolved_lambda_function_name}" resolved_cf_request_function_name = var.cf_request_functi...
facundodossantos/terraform-aws-hosting-lambda
MIT
resources_cf.tf
aws
[ "aws_cloudfront_distribution", "aws_cloudfront_function", "aws_cloudfront_origin_access_control" ]
87c33aed012f6764ae0412c61be9000b
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Provision an internet-facing Application Load Balancer named `ecs-<name>` with HTTPS on port 443 using a specified certificate and SSL policy, plus HTTP-to-HTTPS redirect on port 80, and optionally a test HTTPS listener on port 8443 and test HTTP-to-HTTPS redirect on port 8080; enable access logging to a designated S3 ...
resource "aws_lb" "ecs" { count = var.alb ? 1 : 0 load_balancer_type = "application" internal = false name = "ecs-${var.name}" subnets = var.public_subnet_ids drop_invalid_header_fields = var.alb_drop_invalid_header_fields enable_deletion...
DNXLabs/terraform-aws-ecs
Apache-2.0
alb.tf
aws
[ "aws_lb", "aws_lb_listener", "aws_lb_target_group", "random_string" ]
4494caf136224da671dc645fff742d0c
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Provision a single EC2 instance using the AMI, instance type, subnet ID, security group ID, and key pair name passed as variables, and tag it with a Name combining the provided name prefix and "-instance".
resource "aws_instance" "this" { ami = var.instance.ami instance_type = var.instance.type # 明确由 env 层传入,无任何自动推断 subnet_id = var.subnet_id vpc_security_group_ids = [var.sg_id] key_name = var.keypair_name tags = merge(var.tags, { Name = "${var.name_prefix}-instance" }) }
cloud-neutral-toolkit/iac_modules
Apache-2.0
terraform-hcl-standard/aws-cloud/modules/ec2/main.tf
aws
[ "aws_instance" ]
91c74aa9311aa1f8630ec35c083f10af
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create an Application Load Balancer in a specified VPC, fronting two EC2 instances running Amazon Linux 2023, each launched in a public subnet and assigned a public IP, with a security group allowing inbound HTTP (port 80) and SSH (port 22) traffic as defined by the ingress_rules variable, and configure the load balanc...
data "aws_ami" "amazon_linux" { most_recent = true owners = ["amazon"] filter { name = "name" values = ["al2023-ami-*-x86_64"] } filter { name = "virtualization-type" values = ["hvm"] } } resource "aws_security_group" "web" { name = "${var.project_name}-${var.environment...
cmorellh/aws-infra-tiers
MIT
tier-1-ec2/modules/webserver/main.tf
aws
[ "aws_instance", "aws_lb", "aws_lb_listener", "aws_lb_target_group", "aws_lb_target_group_attachment", "aws_security_group" ]
4849c421b207650b89b072e515301e10
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create an S3 bucket named `slsapp1-lambda-bucket` with public access blocked and automatic deletion of all contents on destroy, then upload a ZIP archive of the `lambda/hello-world` directory as `hello-world.zip`. Set up an IAM role named `slsapp1-lambda-role` that allows the Lambda service to assume it and attach the ...
terraform { required_providers { aws = { source = "hashicorp/aws", } } } provider "aws" { region = var.aws_region } resource "aws_s3_bucket" "lambda_bucket" { bucket = "slsapp1-lambda-bucket" # acl = "private" force_destroy = true } data "archive_file" "lambda_hello_world"...
amitrke/aws-terraform-serverless
Apache-2.0
main.tf
aws
[ "aws_apigatewayv2_api", "aws_apigatewayv2_integration", "aws_apigatewayv2_route", "aws_apigatewayv2_stage", "aws_iam_role", "aws_iam_role_policy_attachment", "aws_lambda_function", "aws_lambda_permission", "aws_s3_bucket", "aws_s3_object" ]
75801db03cf1e9c5fc75977f4e85afc0
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create an AWS Config rule named “elb-acm-certificate-required” that enforces all Elastic Load Balancers use SSL certificates issued by AWS Certificate Manager, and only enable this rule if the configuration flag `elb_acm_certificate_required.enabled` is set to true.
resource "aws_config_config_rule" "elb_acm_certificate_required" { count = var.configuration.elb_acm_certificate_required.enabled ? 1 : 0 name = "elb-acm-certificate-required" description = "This rule checks whether the Elastic Load Balancer(s) uses SSL certificates provided by AWS Certificate Manager. Yo...
geekcell/terraform-aws-config-rules
Apache-2.0
modules/rules/lb/elb_acm_certificate_required.tf
aws
[ "aws_config_config_rule" ]
4838bf04a91486f5427517a9ae3d24a0
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create an AWS Global Accelerator endpoint group with the specified listener ARN, region, health check settings (interval, path, port, protocol), threshold count, and traffic dial percentage; include endpoint configurations with their IDs and weights as provided; ensure the group is created before destroying any existin...
#--------------------------------------------------- # AWS globalaccelerator endpoint group #--------------------------------------------------- resource "aws_globalaccelerator_endpoint_group" "globalaccelerator_endpoint_group" { count = var.enable_globalaccelerator_endpoint_group ? 1 : 0 listener_arn = var.global...
SebastianUA/terraform
Apache-2.0
aws/modules/globalaccelerator/globalaccelerator_endpoint_group.tf
aws
[ "aws_globalaccelerator_endpoint_group" ]
6afc72759c994a9f22f6cd58b4aac750
Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.
Create a CloudFront distribution with a single origin pointing to an S3 bucket, configured to fetch content over HTTP only using TLSv1, allow GET and HEAD requests, cache nothing (all TTLs set to zero), forward all query strings and cookies, redirect viewers to HTTPS, apply no geographic restrictions, and use the defau...
resource "aws_cloudfront_distribution" "cloudfront" { enabled = true origin { origin_id = var.origin_id domain_name = var.bucket_domain_name custom_origin_config { http_port = 80 https_port = 443 origin_protocol_policy = "http-only" origin_ssl_protocol...
LuisCarlosJp/DevOps_IaC_Docker
MIT
Modulo_IAC/AWS/modules/cloudfront/main.tf
aws
[ "aws_cloudfront_distribution" ]
110160cf869ddc69b78782dff16fe393
End of preview. Expand in Data Studio

terraform-multicloud

78,912 natural-language → Terraform (HCL) pairs, drawn from 25,264 public GitHub repositories across 15 provider families. Every target is human-written HCL that passes terraform validate. Every row carries its source repository, licence and file path.

Built by the SASVA AI Model Cognition Labs (MCL) Team and used to train SASVAAI/qwen38-27b-terraform.

What one row looks like

One complete row from data/train.jsonl, reproduced in full with nothing elided:

{
  "instruction": "Write a Terraform configuration for AWS that satisfies the requirement below. Emit only HCL — no explanation, no markdown fences.",
  "input": "Create a VPC with a CIDR block specified by the `vpc_cidr` variable, enable IPv6 assignment, and ensure DNS support and DNS hostnames are both enabled; tag the VPC with the project name provided via the `project_name` variable.",
  "output": "\n# Create a VPC to launch our instances into\nresource \"aws_vpc\" \"kubernetes\" {\n  assign_generated_ipv6_cidr_block = true\n  cidr_block                       = var.vpc_cidr\n\n  # ENPOINT fix\n  enable_dns_support   = true\n  enable_dns_hostnames = true\n\n  \n\n  tags = {\n    Name = \"${var.project_name}\"\n  }\n}",
  "repo": "dvogt/aws-kube-sandbox",
  "license": "Apache-2.0",
  "file_path": "aws-kube-tf-kubernetes/modules/network/vpc.tf",
  "provider_family": "aws",
  "resource_types": [
    "aws_vpc"
  ],
  "signature": "fa677c3c8d1c83372b1079db5d480539"
}

The output field above is a single JSON string; rendered, it is the file exactly as its author committed it:


# Create a VPC to launch our instances into
resource "aws_vpc" "kubernetes" {
  assign_generated_ipv6_cidr_block = true
  cidr_block                       = var.vpc_cidr

  # ENPOINT fix
  enable_dns_support   = true
  enable_dns_hostnames = true

  

  tags = {
    Name = "${var.project_name}"
  }
}
Field Type Meaning
instruction string The task directive. Names the provider family, forbids prose.
input string Plain-language description of the infrastructure wanted.
output string The target .tf file, verbatim as its author wrote it.
repo string Source repository, owner/name. Attribution.
license string That repository's SPDX licence id.
file_path string Path of the file within the repository.
provider_family string Build lane the row came from (one of 15, below).
resource_types list[string] Terraform resource types declared in the output.
signature string Order-insensitive hash of the declared resources. Dedup and contamination key.

output is human-written. instruction and input are model-written — see Provenance.

Statistics

train validation total
Rows 74,909 4,003 78,912
Size on disk 241,099,954 B 12,705,591 B 253,805,545 B
Distinct source repos 23,806 1,458 25,264
Repo overlap — — 0
Distinct resource types 4,784 1,354 4,841
Tokens (Qwen3.8 tokenizer) 54,233,060 2,847,868 57,080,928
Tokens: median / p90 / p99 / max 501 / 1,486 / 3,739 / 8,490 504 / 1,421 / 3,466 / 7,166
output chars: median / p90 / max 1,329 / 4,806 / 27,910 1,346 / 4,714 / 27,724

Provider families

provider_family is the build lane — the extraction pass a row came from — not a parse of the instruction text. The two can disagree for cross-cutting configs (an EKS module is built in the k8s lane but its instruction says AWS).

Family Train Val Family Train Val
aws 45,123 2,337 ibm 710 45
gcp 8,610 492 yandex 686 36
azure 8,546 468 vault 576 19
k8s 4,330 298 docker 458 24
oci 2,111 117 openstack 362 19
alicloud 1,274 46 vsphere 283 17
github 869 42 cloudflare 210 8
digitalocean 761 35

The corpus is AWS-heavy — roughly 60% of rows, about 3:2 against every other family combined.

How it was built

TerraDS archive  →  extract  →  verify  →  dedup  →  back-translate  →  seal  →  split
  1. Extract. Candidate module directories pulled from the TerraDS archive (Zenodo 10.5281/zenodo.20339474), filtered to a 15-licence permissive allowlist.
  2. Verify. terraform init -backend=false + terraform validate at the module-directory level, against a one-version offline provider mirror. Terraform resolves references across every .tf file in a directory, so the directory is the only thing that can be validated — but a training pair is one resource-bearing .tf file. Files without a resource block (variables.tf, outputs.tf, versions.tf) are kept as sibling context and never become pairs.
  3. Dedup. By signature, an order-insensitive hash over resource and data blocks. HCL is declarative: the same resources in a different order are the same config. Scoped to resource/data blocks only — including provider/terraform scaffolding made the contamination seal nearly inert.
  4. Back-translate. A teacher model reads the HCL and writes the plain-language description. Runs after dedup, so the teacher is never paid for rows about to be discarded.
  5. Seal. Rows whose signature collides with an IaC-Eval reference configuration are removed, so a model trained here can still be scored on that benchmark honestly.
  6. Split. Grouped by repository, never by row.

Split discipline

The split is repo-disjoint and verified: 0 of 25,264 repositories appear on both sides. This matters more than usual here. The corpus has a high near- duplicate rate between repositories that copied each other's modules, so a row-level split would put near-identical configs on both sides and turn any eval loss into a recall measurement.

Per-family splits were merged with a resolver rather than concatenated: 5.8% of repositories appear in more than one family lane, and independent per-family splits put 42 repositories train-side in one file and val-side in another. The resolver drops the train-side rows and keeps validation — never the reverse, because shrinking validation changes the eval set and losses are not comparable across eval-set sizes.

Provenance

The HCL is human-written and unaltered. Each output is the source file exactly as its author committed it. The verification stage rewrites dead syntax (stale version pins, 0.11-era type constraints) only inside a throwaway work directory so that terraform init can run offline; those rewrites are discarded and the candidate's original text is what ships.

The instructions are model-written. instruction and input were back-translated from the HCL by a teacher model — the model read the answer and wrote a description of it.

Teacher model. Qwen/Qwen3-Coder-Next.

Licensing

This dataset is released under CC-BY-4.0, inherited from TerraDS, its upstream source.

The code inside remains under its original licences. Every row carries repo, license and file_path, and ATTRIBUTION.csv lists all 25,264 source repositories with their licence and row count, so attribution is possible per-row and in bulk.

Source repositories were filtered to a permissive allowlist before extraction, so unlike a header-based label this is a repository-level licence:

Licence Rows Share
MIT 49,211 62.36%
Apache-2.0 24,750 31.36%
UPL-1.0 1,222 1.55%
Unlicense 937 1.19%
MIT-0 904 1.15%
BSD-3-Clause 892 1.13%
CC0-1.0 472 0.60%
BSD-2-Clause 277 0.35%
WTFPL 141 0.18%
ISC 97 0.12%
0BSD 8 0.01%
BSD-3-Clause-Clear 1 0.00%

76,450 rows (96.9%) are under licences that require attribution and retention of the licence text. If you redistribute this dataset or a derivative of it, carry ATTRIBUTION.csv with it. If you redistribute generated HCL, note that MIT and Apache-2.0 obligations attach to the training material, not automatically to model output — but the two are close enough here that the conservative reading is the safe one.

Apache-2.0 §4(b) requires retention of NOTICE files. Those files are not carried in this dataset: the unit is a single .tf file, and repository-root NOTICE files were outside the extraction. ATTRIBUTION.csv plus repo is the route back to them.

Removal requests

If your repository appears in ATTRIBUTION.csv and you want it removed, open a discussion on this dataset. Removals are applied by repo across both splits and the file is regenerated.

Intended use

Supervised fine-tuning for natural-language → Terraform generation. The training rendering used for the reference model is:

<|im_start|>system
{SYSTEM}<|im_end|>
<|im_start|>user
{instruction}

```
{input}
```<|im_end|>
<|im_start|>assistant
{output}<|im_end|>

The user turn's payload is fenced. The reference model additionally trained with an empty <think></think> block before the answer.

from datasets import load_dataset
ds = load_dataset("SASVAAI/terraform-multicloud")           # train: 74,909 · validation: 4,003
aws = ds["train"].filter(lambda r: r["provider_family"] == "aws")

Out of scope. This is not a benchmark. The validation split is a held-out sample of the same distribution, scored by loss; it has no execution harness, no Rego policies and no pass/fail oracle. For scored evaluation use IaC-Eval, which this corpus is deliberately disjoint from.

Citation

@misc{terraform_multicloud_2026,
  title  = {terraform-multicloud: Natural-language to Terraform pairs from permissively licensed repositories},
  author = {{SASVA AI Model Cognition Labs (MCL) Team}},
  year   = {2026},
  url    = {https://huggingface.co/datasets/SASVAAI/terraform-multicloud}
}

@dataset{terrads,
  title     = {TerraDS: A Dataset for Terraform HCL Programs},
  year      = {2025},
  publisher = {Zenodo},
  doi       = {10.5281/zenodo.20339474}
}

@inproceedings{iaceval2024,
  title     = {IaC-Eval: A Code Generation Benchmark for Infrastructure-as-Code Programs},
  booktitle = {NeurIPS Datasets and Benchmarks},
  year      = {2024}
}
Downloads last month
58