{"id":21820640,"url":"https://github.com/sue445/terraform-aws-template","last_synced_at":"2025-04-14T03:01:32.235Z","repository":{"id":36987467,"uuid":"372133228","full_name":"sue445/terraform-aws-template","owner":"sue445","description":"Terraform template for AWS","archived":false,"fork":false,"pushed_at":"2025-04-11T10:11:00.000Z","size":365,"stargazers_count":6,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-11T11:57:28.955Z","etag":null,"topics":["aws","template","template-project","terraform"],"latest_commit_sha":null,"homepage":"","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sue445.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2021-05-30T05:40:53.000Z","updated_at":"2025-04-11T10:11:04.000Z","dependencies_parsed_at":"2024-03-04T01:41:33.422Z","dependency_job_id":"bb44239c-80b4-4fe8-9add-c9cde0207e01","html_url":"https://github.com/sue445/terraform-aws-template","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sue445%2Fterraform-aws-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sue445%2Fterraform-aws-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sue445%2Fterraform-aws-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sue445%2Fterraform-aws-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sue445","download_url":"https://codeload.github.com/sue445/terraform-aws-template/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248813789,"owners_count":21165633,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","template","template-project","terraform"],"created_at":"2024-11-27T16:38:07.956Z","updated_at":"2025-04-14T03:01:32.227Z","avatar_url":"https://github.com/sue445.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# terraform-aws-template\n[Terraform](https://www.terraform.io/) template for [AWS](https://aws.amazon.com/)\n\n## :information_desk_person: Migrate to S3-native state locking\n\u003e [!NOTE]\n\u003e If you want to migrate from DynamoDB state locking to S3-native state locking,\n\u003e read [this migration guide](MIGRATE_TO_S3_NATIVE_STATE_LOCKNG.md)\n\n## [Workflow](.github/workflows/terraform.yml) features\n* Authenticating via [GitHub OIDC provider](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-amazon-web-services)\n* Run `terraform apply`\n    * Automatically running on `main` branch\n    * Manual running on any branch\n* Run `terraform plan`, `terraform fmt` and [tflint](https://github.com/terraform-linters/tflint)\n* Post `terraform plan` report to PullRequest comment and Job Summaries\n* Slack notification\n\n## Requirements\n* GitHub Actions\n* Terraform v1.10+\n\n## Usage of this template\n### 1. Install tools\n* [tfenv](https://github.com/tfutils/tfenv)\n\n### 2. Create a repository using this template\n\n### 3. Setup terraform with CloudFormation\n1. Download [cloud_formation/setup-terraform.yml](cloud_formation/setup-terraform.yml)\n2. Go to [CloudFormation](https://console.aws.amazon.com/console/home)\n3. Create stack with downloaded `setup-terraform.yml`\n\n#### Parameters\n* `BackendBucketName` **(Required)**\n  * Name of backend bucket. \n  * c.f. https://www.terraform.io/language/settings/backends/s3\n* `TerraformLockTableName` **(Required)**\n  * Name of lock table name for terraform. \n  * c.f. https://www.terraform.io/language/settings/backends/s3\n  * default: `terraform-lock`\n* `GithubOidcRoleName` **(Required)**\n  * IAM Role name for OIDC authentication\n  * default: `github-oidc-role`\n* `GitHubOrgName` **(Required)**\n  * GitHub organization or user name (e.g. `octocat`)\n* `GitHubRepositoryName` **(Required)**\n  * GitHub repository name (e.g. `Hello-World`)\n* `OIDCProviderArn` (optional)\n  * Arn for the GitHub OIDC Provider.\n  * A new provider will be created if omitted\n\n### 4. Register secrets\n* `SLACK_WEBHOOK` (optional)\n    * Create from https://slack.com/apps/A0F7XDUAZ\n\n### 5. Edit files\n#### [.github/workflows/terraform.yml](.github/workflows/terraform.yml)\nEdit followings\n\n* `GITHUB_OIDC_PROVIDER_ROLE`\n  * This is crated by [cloud_formation/setup-terraform.yml](cloud_formation/setup-terraform.yml). See CloudFormation stack output\n* `AWS_REGION`\n  * Same to the region where Cloudformation was executed\n\n#### [.terraform-version](.terraform-version)\n* Upgrade to the latest version if necessary\n\n#### [backend.tf](backend.tf)\nEdit followings\n\n* `terraform.backend.bucket`\n  * Same to `BackendBucketName` of [cloud_formation/setup-terraform.yml](cloud_formation/setup-terraform.yml) parameter\n* `terraform.backend.region`\n  * Same to the region where Cloudformation was executed\n\n#### [terraform.tfvars](terraform.tfvars)\nEdit followings\n\n* `aws_account_id`\n  * AWS account ID\n* `provider_region`\n  * Same to the region where Cloudformation was executed\n\n#### [versions.tf](versions.tf)\nUpgrade to the latest version if necessary\n\n* `terraform.required_providers.aws.version`\n* `terraform.required_version`\n\n### 6. Run Terraform from local\n```bash\ntfenv install\n\nterraform init\n\n# Run followings if you upgraded providers\nterraform init -upgrade\ngit add .terraform.lock.hcl\ngit commit -m \"terraform init -upgrade\"\n\ngit push\n```\n\n### 7. Check if GitHub Actions build is executed\n\n## Maintenance for Terraform repository\n### Upgrade Terraform core\n1. Check latest version\n    * https://github.com/hashicorp/terraform/blob/main/CHANGELOG.md\n2. Edit [.terraform-version](.terraform-version)\n3. Run `tfenv install`\n\n### Upgrade Terraform providers (automatically)\n1. Edit [.github/dependabot.yml](.github/dependabot.yml)\n2. Wait for Dependabot to create a PullRequests\n\n### Upgrade Terraform providers (manually)\n1. Check latest versions\n    * https://github.com/terraform-providers/terraform-provider-aws/blob/master/CHANGELOG.md\n2. Edit `terraform.required_providers.aws.version` in [versions.tf](versions.tf)\n3. Run `terraform init -upgrade`\n\n## Other solution\n* https://github.com/sue445/terraform-gcp-template\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsue445%2Fterraform-aws-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsue445%2Fterraform-aws-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsue445%2Fterraform-aws-template/lists"}