https://github.com/tmslpm/terra-gh
Repository managed by Terraform!
https://github.com/tmslpm/terra-gh
cli github terraform
Last synced: 5 months ago
JSON representation
Repository managed by Terraform!
- Host: GitHub
- URL: https://github.com/tmslpm/terra-gh
- Owner: tmslpm
- License: mit
- Created: 2025-01-13T11:13:00.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-18T22:19:22.000Z (over 1 year ago)
- Last Synced: 2025-03-30T21:33:03.549Z (about 1 year ago)
- Topics: cli, github, terraform
- Language: HCL
- Homepage:
- Size: 313 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- Contributing: .github/contributing.md
- License: license.md
- Code of conduct: .github/code_of_conduct.md
- Codeowners: .github/CODEOWNERS
- Security: .github/security.md
Awesome Lists containing this project
README
Terraform + Github
## Note

### Setup
```sh
# define env var BUCKET_ACCESS
# define env var BUCKET_SECRET
# define env var GITHUB_TOKEN
# go to terra folder
cd ./.terraform
# create terraform.tfbackend
cp "./templates/terraform.tfbackend.template" "./terraform.tfbackend"
# init
terraform init --backend-config="./terraform.tfbackend" \
-backend-config="access_key=$BUCKET_ACCESS" \
-backend-config="secret_key=$BUCKET_SECRET"
```
### Then
```sh
terraform plan -var="github_token=$GITHUB_TOKEN"
terraform apply -var="github_token=$GITHUB_TOKEN"
```
## Import Existing Resources
```sh
terraform import github_repository.$github_name $repo_name
# example
terraform import github_repository.tmslpm terra-gh
```
> https://registry.terraform.io/providers/integrations/github/latest/docs/resources/repository#import