Skip to content

Add terraform examples folder structure#1

Merged
jblaaa-codes-ms merged 2 commits into
mainfrom
copilot/create-folder-structure
Jul 16, 2026
Merged

Add terraform examples folder structure#1
jblaaa-codes-ms merged 2 commits into
mainfrom
copilot/create-folder-structure

Conversation

Copilot AI commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Bootstraps the repo with a consistent, scalable folder layout for hosting multiple Terraform examples across cloud providers.

Structure

examples/
├── aws/
│   ├── ec2-instance/
│   ├── s3-bucket/
│   └── vpc/
├── azure/
│   ├── resource-group/
│   └── virtual-network/
└── gcp/
    ├── gke-cluster/
    └── vpc-network/
modules/          # reusable modules landing zone

Conventions

  • Every example is self-contained under examples/<provider>/<resource>/
  • Each folder follows the standard five-file layout: main.tf, variables.tf, outputs.tf, versions.tf, README.md
  • Provider version constraints pinned in versions.tf (AWS ~> 5.0, AzureRM ~> 3.0, Google ~> 5.0)
  • .gitignore covers .terraform/, state files, lock files, and *.tfvars
  • Root README.md updated with structure overview, per-example usage pattern, and contributing guide
Original prompt

create a folder structure that best suites a repo that will contain several terraform examples.

Copilot AI changed the title [WIP] Create folder structure for terraform examples Add terraform examples folder structure Jul 16, 2026
Copilot AI requested a review from jblaaa-codes-ms July 16, 2026 12:48
@jblaaa-codes-ms

jblaaa-codes-ms commented Jul 16, 2026

Copy link
Copy Markdown
Owner

@copilot the examples would NOT have anything other than azure, can you remove any of the aws type structure?

@jblaaa-codes-ms
jblaaa-codes-ms marked this pull request as ready for review July 16, 2026 13:11
@jblaaa-codes-ms
jblaaa-codes-ms requested a review from Copilot July 16, 2026 13:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Bootstraps the repository with a consistent Terraform examples layout (by cloud provider and resource/use-case), plus baseline documentation and ignore rules to support adding more examples over time.

Changes:

  • Added a standardized examples/<provider>/<example>/ structure with initial AWS, Azure, and GCP examples (each with main.tf, variables.tf, outputs.tf, versions.tf, README.md).
  • Added modules/ as a landing zone for reusable Terraform modules with a starter README.
  • Updated root README.md and added .gitignore for Terraform artifacts.

Reviewed changes

Copilot reviewed 37 out of 38 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
README.md Documents repo purpose, structure, and the standard example layout/usage flow.
.gitignore Ignores Terraform working directories, state/plan files, and tfvars.
modules/README.md Introduces the intended reusable module area and basic usage guidance.
examples/aws/ec2-instance/main.tf Adds an EC2 instance example using latest Amazon Linux 2 AMI selection.
examples/aws/ec2-instance/variables.tf Defines inputs for the EC2 instance example.
examples/aws/ec2-instance/outputs.tf Exposes basic EC2 outputs.
examples/aws/ec2-instance/versions.tf Pins Terraform/provider constraints and configures the AWS provider.
examples/aws/ec2-instance/README.md Documents the EC2 instance example usage and inputs/outputs.
examples/aws/s3-bucket/main.tf Adds an S3 bucket example with encryption, versioning option, and public access block.
examples/aws/s3-bucket/variables.tf Defines inputs for the S3 bucket example.
examples/aws/s3-bucket/outputs.tf Exposes basic S3 outputs.
examples/aws/s3-bucket/versions.tf Pins Terraform/provider constraints and configures the AWS provider.
examples/aws/s3-bucket/README.md Documents the S3 bucket example usage and inputs/outputs.
examples/aws/vpc/main.tf Adds a VPC example with public/private subnets and routing resources.
examples/aws/vpc/variables.tf Defines inputs for the VPC example.
examples/aws/vpc/outputs.tf Exposes VPC/subnet/IGW outputs.
examples/aws/vpc/versions.tf Pins Terraform/provider constraints and configures the AWS provider.
examples/aws/vpc/README.md Documents the VPC example usage and inputs/outputs.
examples/azure/resource-group/main.tf Adds a basic Azure resource group example.
examples/azure/resource-group/variables.tf Defines inputs for the Azure resource group example.
examples/azure/resource-group/outputs.tf Exposes Azure resource group outputs.
examples/azure/resource-group/versions.tf Pins Terraform/provider constraints and configures the AzureRM provider.
examples/azure/resource-group/README.md Documents the Azure resource group example usage and inputs/outputs.
examples/azure/virtual-network/main.tf Adds a basic Azure VNet + subnet example (including RG creation).
examples/azure/virtual-network/variables.tf Defines inputs for the Azure virtual network example.
examples/azure/virtual-network/outputs.tf Exposes Azure VNet/subnet outputs.
examples/azure/virtual-network/versions.tf Pins Terraform/provider constraints and configures the AzureRM provider.
examples/azure/virtual-network/README.md Documents the Azure virtual network example usage and inputs/outputs.
examples/gcp/gke-cluster/main.tf Adds a basic GKE cluster example.
examples/gcp/gke-cluster/variables.tf Defines inputs for the GKE cluster example.
examples/gcp/gke-cluster/outputs.tf Exposes GKE outputs (with sensitive markings).
examples/gcp/gke-cluster/versions.tf Pins Terraform/provider constraints and configures the Google provider.
examples/gcp/gke-cluster/README.md Documents the GKE cluster example usage and inputs/outputs.
examples/gcp/vpc-network/main.tf Adds a GCP VPC + subnetwork example.
examples/gcp/vpc-network/variables.tf Defines inputs for the GCP VPC network example.
examples/gcp/vpc-network/outputs.tf Exposes VPC/subnetwork outputs.
examples/gcp/vpc-network/versions.tf Pins Terraform/provider constraints and configures the Google provider.
examples/gcp/vpc-network/README.md Documents the GCP VPC network example usage and inputs/outputs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread examples/aws/vpc/main.tf
Comment on lines +25 to +30
resource "aws_subnet" "public" {
count = length(var.public_subnet_cidrs)
vpc_id = aws_vpc.this.id
cidr_block = var.public_subnet_cidrs[count.index]
availability_zone = data.aws_availability_zones.available.names[count.index]

Comment thread examples/aws/vpc/main.tf
Comment on lines +39 to +44
resource "aws_subnet" "private" {
count = length(var.private_subnet_cidrs)
vpc_id = aws_vpc.this.id
cidr_block = var.private_subnet_cidrs[count.index]
availability_zone = data.aws_availability_zones.available.names[count.index]

Comment thread modules/README.md
Comment on lines +21 to +28
Reference a module from an example or an external configuration using a relative path:

```hcl
module "example" {
source = "../../modules/<module-name>"

# module inputs
}
Comment on lines +9 to +26
## Usage

```hcl
module "ec2" {
source = "../../examples/aws/ec2-instance"

region = "us-east-1"
instance_type = "t3.micro"
name = "my-instance"
}
```

Or use directly:

```bash
terraform init
terraform apply -var="name=my-instance"
```
@jblaaa-codes-ms
jblaaa-codes-ms merged commit 884bf93 into main Jul 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants