Skip to content

Commit

Permalink
Update README.md with repository structure and configuration details;…
Browse files Browse the repository at this point in the history
… enhance main.tf and variables.tf comments; add .terraform.lock.hcl and terraform.tfstate files for state management
  • Loading branch information
Dave Arnold committed Apr 29, 2025
1 parent 50f15e8 commit ec2b0da
Show file tree
Hide file tree
Showing 7 changed files with 179 additions and 31 deletions.
24 changes: 24 additions & 0 deletions .terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

74 changes: 74 additions & 0 deletions .tflog
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,77 @@
2025-04-17T01:21:26.795-0700 [TRACE] statemgr.Filesystem: read nil snapshot
2025-04-17T01:21:26.795-0700 [TRACE] backend/local: populating backendrun.LocalRun for current working directory
2025-04-17T01:21:26.807-0700 [TRACE] Config.VerifyDependencySelections: provider registry.terraform.io/hashicorp/aws has no lock file entry to satisfy ""
2025-04-29T09:32:02.115-0700 [INFO] Terraform version: 1.10.5
2025-04-29T09:32:02.116-0700 [DEBUG] using github.com/hashicorp/go-tfe v1.70.0
2025-04-29T09:32:02.116-0700 [DEBUG] using github.com/hashicorp/hcl/v2 v2.23.0
2025-04-29T09:32:02.116-0700 [DEBUG] using github.com/hashicorp/terraform-svchost v0.1.1
2025-04-29T09:32:02.116-0700 [DEBUG] using github.com/zclconf/go-cty v1.16.2
2025-04-29T09:32:02.116-0700 [INFO] Go runtime version: go1.23.3
2025-04-29T09:32:02.116-0700 [INFO] CLI args: []string{"/usr/local/Cellar/tfenv/1.0.2/versions/1.10.5/terraform", "providers", "schema", "-json", "-no-color"}
2025-04-29T09:32:02.116-0700 [TRACE] Stdout is not a terminal
2025-04-29T09:32:02.116-0700 [TRACE] Stderr is not a terminal
2025-04-29T09:32:02.116-0700 [TRACE] Stdin is not a terminal
2025-04-29T09:32:02.116-0700 [DEBUG] Attempting to open CLI config file: /Users/darnold/.terraformrc
2025-04-29T09:32:02.116-0700 [INFO] Loading CLI configuration from /Users/darnold/.terraformrc
2025-04-29T09:32:02.116-0700 [INFO] Loading CLI configuration from /Users/darnold/.terraform.d/credentials.tfrc.json
2025-04-29T09:32:02.116-0700 [DEBUG] checking for credentials in "/Users/darnold/.terraform.d/plugins"
2025-04-29T09:32:02.116-0700 [DEBUG] checking for credentials in "/Users/darnold/.terraform.d/plugins/darwin_amd64"
2025-04-29T09:32:02.116-0700 [DEBUG] Using modified User-Agent: HashiCorp Terraform/1.10.5 (+https://www.terraform.io) HashiCorp-terraform-exec/0.21.0
2025-04-29T09:32:02.116-0700 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins
2025-04-29T09:32:02.116-0700 [DEBUG] will search for provider plugins in /Users/darnold/.terraform.d/plugins
2025-04-29T09:32:02.117-0700 [WARN] local provider path "/Users/darnold/.terraform.d/plugins/HappyPathway/openai/0.1.0" contains invalid type "0.1.0"; ignoring
2025-04-29T09:32:02.117-0700 [WARN] local provider path "/Users/darnold/.terraform.d/plugins/HappyPathway/openai/0.1.0/darwin_amd64" contains invalid type "0.1.0"; ignoring
2025-04-29T09:32:02.117-0700 [WARN] local provider path "/Users/darnold/.terraform.d/plugins/HappyPathway/openai/0.1.0/darwin_amd64/terraform-provider-openai" contains invalid type "0.1.0"; ignoring
2025-04-29T09:32:02.117-0700 [WARN] local provider path "/Users/darnold/.terraform.d/plugins/darnold/gigrack/0.1.0" contains invalid type "0.1.0"; ignoring
2025-04-29T09:32:02.117-0700 [WARN] local provider path "/Users/darnold/.terraform.d/plugins/darnold/gigrack/0.1.0/darwin_amd64" contains invalid type "0.1.0"; ignoring
2025-04-29T09:32:02.117-0700 [WARN] local provider path "/Users/darnold/.terraform.d/plugins/darnold/gigrack/0.1.0/darwin_amd64/terraform-provider-gigrack" contains invalid type "0.1.0"; ignoring
2025-04-29T09:32:02.117-0700 [WARN] Provider plugin search ignored symlink /Users/darnold/.terraform.d/plugins/darwin_amd64/terraform-provider-configstash: only the base directory /Users/darnold/.terraform.d/plugins may be a symlink
2025-04-29T09:32:02.117-0700 [TRACE] getproviders.SearchLocalDirectory: found hashicorp.com/edu/hashicups v0.3.1 for darwin_amd64 at /Users/darnold/.terraform.d/plugins/hashicorp.com/edu/hashicups/0.3.1/darwin_amd64
2025-04-29T09:32:02.117-0700 [TRACE] getproviders.SearchLocalDirectory: found registry.terraform.io/darnold/gigrack v0.1.0 for darwin_amd64 at /Users/darnold/.terraform.d/plugins/registry.terraform.io/darnold/gigrack/0.1.0/darwin_amd64
2025-04-29T09:32:02.118-0700 [WARN] ignoring local provider path "/Users/darnold/.terraform.d/plugins/registry.terraform.io/darnold/openai/3b6fef8/darwin_amd64" with invalid version "3b6fef8": invalid characters "b6fef8"
2025-04-29T09:32:02.118-0700 [WARN] ignoring local provider path "/Users/darnold/.terraform.d/plugins/registry.terraform.io/darnold/openai/70f25a4/darwin_amd64" with invalid version "70f25a4": invalid characters "f25a4"
2025-04-29T09:32:02.118-0700 [TRACE] getproviders.SearchLocalDirectory: found registry.terraform.io/happypathway/openai v5.0.0 for darwin_amd64 at /Users/darnold/.terraform.d/plugins/registry.terraform.io/happypathway/openai/5.0.0/darwin_amd64
2025-04-29T09:32:02.118-0700 [DEBUG] ignoring non-existing provider search directory /Users/darnold/Library/Application Support/io.terraform/plugins
2025-04-29T09:32:02.118-0700 [DEBUG] ignoring non-existing provider search directory /Library/Application Support/io.terraform/plugins
2025-04-29T09:32:02.120-0700 [INFO] Checkpoint disabled. Not running.
2025-04-29T09:32:02.122-0700 [INFO] CLI command args: []string{"providers", "schema", "-json", "-no-color"}
2025-04-29T09:32:02.122-0700 [DEBUG] Using modified User-Agent: Terraform/1.10.5 HashiCorp-terraform-exec/0.21.0
2025-04-29T09:32:02.122-0700 [DEBUG] Using modified User-Agent: HashiCorp Terraform/1.10.5 (+https://www.terraform.io) HashiCorp-terraform-exec/0.21.0
2025-04-29T09:32:02.123-0700 [TRACE] Meta.Backend: BackendOpts.Config not set, so using settings loaded from backend.tf:2,3-16
2025-04-29T09:32:02.123-0700 [TRACE] Meta.Backend: built configuration for "gcs" backend with hash value 3602047810
2025-04-29T09:32:02.123-0700 [TRACE] Meta.Backend: backend has not previously been initialized in this working directory
2025-04-29T09:32:02.123-0700 [TRACE] Meta.Backend: moving from default local state only to "gcs" backend
2025-04-29T09:36:48.710-0700 [INFO] Terraform version: 1.10.5
2025-04-29T09:36:48.711-0700 [DEBUG] using github.com/hashicorp/go-tfe v1.70.0
2025-04-29T09:36:48.711-0700 [DEBUG] using github.com/hashicorp/hcl/v2 v2.23.0
2025-04-29T09:36:48.711-0700 [DEBUG] using github.com/hashicorp/terraform-svchost v0.1.1
2025-04-29T09:36:48.711-0700 [DEBUG] using github.com/zclconf/go-cty v1.16.2
2025-04-29T09:36:48.711-0700 [INFO] Go runtime version: go1.23.3
2025-04-29T09:36:48.711-0700 [INFO] CLI args: []string{"/usr/local/Cellar/tfenv/1.0.2/versions/1.10.5/terraform", "version", "-json"}
2025-04-29T09:36:48.711-0700 [TRACE] Stdout is not a terminal
2025-04-29T09:36:48.711-0700 [TRACE] Stderr is not a terminal
2025-04-29T09:36:48.711-0700 [TRACE] Stdin is not a terminal
2025-04-29T09:36:48.711-0700 [DEBUG] Attempting to open CLI config file: /Users/darnold/.terraformrc
2025-04-29T09:36:48.711-0700 [INFO] Loading CLI configuration from /Users/darnold/.terraformrc
2025-04-29T09:36:48.711-0700 [INFO] Loading CLI configuration from /Users/darnold/.terraform.d/credentials.tfrc.json
2025-04-29T09:36:48.711-0700 [DEBUG] checking for credentials in "/Users/darnold/.terraform.d/plugins"
2025-04-29T09:36:48.711-0700 [DEBUG] checking for credentials in "/Users/darnold/.terraform.d/plugins/darwin_amd64"
2025-04-29T09:36:48.711-0700 [DEBUG] Using modified User-Agent: HashiCorp Terraform/1.10.5 (+https://www.terraform.io) HashiCorp-terraform-exec/0.21.0
2025-04-29T09:36:48.711-0700 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins
2025-04-29T09:36:48.711-0700 [DEBUG] will search for provider plugins in /Users/darnold/.terraform.d/plugins
2025-04-29T09:36:48.711-0700 [WARN] local provider path "/Users/darnold/.terraform.d/plugins/HappyPathway/openai/0.1.0" contains invalid type "0.1.0"; ignoring
2025-04-29T09:36:48.711-0700 [WARN] local provider path "/Users/darnold/.terraform.d/plugins/HappyPathway/openai/0.1.0/darwin_amd64" contains invalid type "0.1.0"; ignoring
2025-04-29T09:36:48.711-0700 [WARN] local provider path "/Users/darnold/.terraform.d/plugins/HappyPathway/openai/0.1.0/darwin_amd64/terraform-provider-openai" contains invalid type "0.1.0"; ignoring
2025-04-29T09:36:48.711-0700 [WARN] local provider path "/Users/darnold/.terraform.d/plugins/darnold/gigrack/0.1.0" contains invalid type "0.1.0"; ignoring
2025-04-29T09:36:48.711-0700 [WARN] local provider path "/Users/darnold/.terraform.d/plugins/darnold/gigrack/0.1.0/darwin_amd64" contains invalid type "0.1.0"; ignoring
2025-04-29T09:36:48.711-0700 [WARN] local provider path "/Users/darnold/.terraform.d/plugins/darnold/gigrack/0.1.0/darwin_amd64/terraform-provider-gigrack" contains invalid type "0.1.0"; ignoring
2025-04-29T09:36:48.711-0700 [WARN] Provider plugin search ignored symlink /Users/darnold/.terraform.d/plugins/darwin_amd64/terraform-provider-configstash: only the base directory /Users/darnold/.terraform.d/plugins may be a symlink
2025-04-29T09:36:48.712-0700 [TRACE] getproviders.SearchLocalDirectory: found hashicorp.com/edu/hashicups v0.3.1 for darwin_amd64 at /Users/darnold/.terraform.d/plugins/hashicorp.com/edu/hashicups/0.3.1/darwin_amd64
2025-04-29T09:36:48.712-0700 [TRACE] getproviders.SearchLocalDirectory: found registry.terraform.io/darnold/gigrack v0.1.0 for darwin_amd64 at /Users/darnold/.terraform.d/plugins/registry.terraform.io/darnold/gigrack/0.1.0/darwin_amd64
2025-04-29T09:36:48.712-0700 [WARN] ignoring local provider path "/Users/darnold/.terraform.d/plugins/registry.terraform.io/darnold/openai/3b6fef8/darwin_amd64" with invalid version "3b6fef8": invalid characters "b6fef8"
2025-04-29T09:36:48.712-0700 [WARN] ignoring local provider path "/Users/darnold/.terraform.d/plugins/registry.terraform.io/darnold/openai/70f25a4/darwin_amd64" with invalid version "70f25a4": invalid characters "f25a4"
2025-04-29T09:36:48.712-0700 [TRACE] getproviders.SearchLocalDirectory: found registry.terraform.io/happypathway/openai v5.0.0 for darwin_amd64 at /Users/darnold/.terraform.d/plugins/registry.terraform.io/happypathway/openai/5.0.0/darwin_amd64
2025-04-29T09:36:48.712-0700 [DEBUG] ignoring non-existing provider search directory /Users/darnold/Library/Application Support/io.terraform/plugins
2025-04-29T09:36:48.712-0700 [DEBUG] ignoring non-existing provider search directory /Library/Application Support/io.terraform/plugins
2025-04-29T09:36:48.715-0700 [INFO] Checkpoint disabled. Not running.
2025-04-29T09:36:48.716-0700 [INFO] CLI command args: []string{"version", "-json"}
49 changes: 48 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,26 @@ with custom configurations from your template.

## Architecture

- AWS Lambda container image built with Packer and stored in ECR
- AWS Lambda container image built with Packer and stored in ECR
- Infrastructure managed with Terraform
- Automated CI/CD using GitHub Actions
- Secret management using AWS Systems Manager Parameter Store

## Repository Structure

This project is split into two repositories:

1. **template-automation-lambda** (this repository)
- Contains the Lambda function source code
- Builds the container image with Packer
- Publishes the image to ECR

2. **terraform-aws-template-automation**
- Terraform module that deploys the Lambda infrastructure
- Creates and configures all required AWS resources
- Manages GitHub-specific configuration via SSM parameters
- Handles permissions, API Gateway, and other infrastructure

## Prerequisites

- AWS credentials with appropriate permissions
Expand All @@ -23,6 +38,38 @@ with custom configurations from your template.
- Packer
- Python 3.11+

## Configuration

### Lambda Configuration

The Lambda function gets its configuration from SSM Parameter Store with the following parameters:

- `/template-automation/GITHUB_API` - GitHub API URL
- `/template-automation/GITHUB_ORG_NAME` - GitHub organization name
- `/template-automation/TEMPLATE_REPO_NAME` - Name of the template repository
- `/template-automation/TEMPLATE_CONFIG_FILE` - Name of the config file (default: config.json)
- `/template-automation/GITHUB_COMMIT_AUTHOR_NAME` - Name for commit author
- `/template-automation/GITHUB_COMMIT_AUTHOR_EMAIL` - Email for commit author
- `/template-automation/TEMPLATE_TOPICS` - Comma-separated list of repository topics

### Terraform Module Configuration

These parameters are managed by the `terraform-aws-template-automation` module. When deploying
the Lambda function using the Terraform module, configure these variables in the module:

```hcl
module "template_automation" {
source = "github.com/HappyPathway/terraform-aws-template-automation"
# GitHub configuration
github_api_url = "https://api.github.com"
github_org_name = "your-org"
template_repo_name = "your-template-repo"
# Other module configuration...
}
```

## Local Development

1. Clone this repository:
Expand Down
5 changes: 5 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#
# This Terraform configuration creates only the ECR repository for the container image.
# The Lambda function, API Gateway, IAM roles, and other infrastructure are managed by
# the terraform-aws-template-automation module.

provider "aws" {
region = var.aws_region
}
Expand Down
19 changes: 19 additions & 0 deletions terraform_data_dirs/default/terraform.tfstate
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"version": 3,
"terraform_version": "1.10.5",
"backend": {
"type": "gcs",
"config": {
"access_token": null,
"bucket": "hpw-terraform-state",
"credentials": null,
"encryption_key": null,
"impersonate_service_account": null,
"impersonate_service_account_delegates": null,
"kms_encryption_key": null,
"prefix": "eks-automation-lambda",
"storage_custom_endpoint": null
},
"hash": 3602047810
}
}
38 changes: 8 additions & 30 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@

# Note: GitHub-specific variables (github_api, github_org_name, template_repo_name, etc.)
# have been moved to the terraform-aws-template-automation module.
# They are now configured as SSM parameters in that module.
#
# This file contains only variables related to the container image and
# ECR repository setup.

variable "aws_region" {
description = "AWS region where resources will be created"
type = string
Expand All @@ -16,36 +24,6 @@ variable "environment" {
default = "production"
}

variable "github_api" {
description = "URL for the GitHub Enterprise API"
type = string
default = "https://github.enterprise.example.com/api/v3"
}

variable "github_org_name" {
description = "GitHub organization name"
type = string
default = "your-org"
}

variable "github_token_secret_name" {
description = "AWS SSM parameter name for the GitHub token"
type = string
default = "/github/token"
}

variable "template_repo_name" {
description = "GitHub repository name for the EKS template"
type = string
default = "template-eks-cluster"
}

variable "template_file_name" {
description = "Template file name for the EKS configuration"
type = string
default = "eks.hcl.j2"
}

variable "catalog_data" {
description = "Configuration for the ECR repository catalog data"
type = object({
Expand Down

0 comments on commit ec2b0da

Please sign in to comment.