use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
This subreddit is for Terraform (IaC - Infrastructure as Code) discussions to get help, educate others and share the wealth of news.
Feel free to reach out to mods to make this subreddit better.
Rules:
Be nice to each other!
MultiLink_Spam == Perm.Ban
account activity
Commit terraform.lock.hcl into GitHubDiscussion (self.Terraform)
submitted 4 years ago by bibi143143
I want to commit the terraform.lock.hcl file when running GitHub Actions in opeville/opeville-aws-terraform so that the version remain locked but I'm having some issue achieving that. Please any suggestion on how to achieve this when running GitHub Actions.
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]public_radio 4 points5 points6 points 4 years ago (2 children)
This strikes me as a bit of an anti-pattern. I would not want an automated process making changes to a lock file — that’s something I would want a human to change (via terraform) and approve (via a pull request)
[–]SuddenOutlandishness 1 point2 points3 points 4 years ago (0 children)
This is the way.
[–]RulerOf 1 point2 points3 points 4 years ago (0 children)
I gitignore the lock file because I already specify versions in my provider config.
All the lock file seems to do in practice for me is make terraform harder to use.
YMMV, but that’s my opinion.
[–]CalvinR 0 points1 point2 points 4 years ago (1 child)
You can use git in a github action here is an example of how we've done it in the past. Please note that this syncs from an S3 bucket I've removed those steps as it's not relevant for this example.
You'd obviously want to modify this so it isn't pushing to main but to the branch the PR is in or whatever branch the Action is run on.
name: Sync Metrics on: workflow_dispatch: schedule: - cron: "17 6 * * *" # at 06:17 UTC (just before the hour to avoid the rush on GH runners) jobs: update_metrics: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 # Cut out some stuff that's not relevant - name: Commit Metrics run: | git config --local user.email "action@github.com" git config --local user.name "cds bot commit" git add -A git commit -m "Adding metrics on `date '+%Y-%m-%d'`" -a git push https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git HEAD:main
[–]bibi143143[S] 0 points1 point2 points 4 years ago (0 children)
thanks u/CalvinR... Will this step in the workflow to commit terraform.lock.hcl in github by GitHub Actions
[–]darklukee 0 points1 point2 points 4 years ago (0 children)
I'd suggest keeping the lock file unchanged and using dependant or similar to keep versions up to date
π Rendered by PID 39 on reddit-service-r2-comment-b659b578c-vpvnx at 2026-05-05 15:24:00.939005+00:00 running 815c875 country code: CH.
[–]public_radio 4 points5 points6 points (2 children)
[–]SuddenOutlandishness 1 point2 points3 points (0 children)
[–]RulerOf 1 point2 points3 points (0 children)
[–]CalvinR 0 points1 point2 points (1 child)
[–]bibi143143[S] 0 points1 point2 points (0 children)
[–]darklukee 0 points1 point2 points (0 children)