{"id":22983655,"url":"https://github.com/tibeer/terraform-dyndns","last_synced_at":"2026-01-30T08:32:33.462Z","repository":{"id":105008693,"uuid":"585619036","full_name":"tibeer/terraform-dyndns","owner":"tibeer","description":"DynDNS solution to update DNS records periodically","archived":false,"fork":false,"pushed_at":"2024-02-05T11:27:05.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-02T10:43:46.746Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tibeer.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,"publiccode":null,"codemeta":null}},"created_at":"2023-01-05T16:25:19.000Z","updated_at":"2023-01-09T14:08:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"6ab35d17-512b-475b-ba7a-22eb8bacc37f","html_url":"https://github.com/tibeer/terraform-dyndns","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tibeer/terraform-dyndns","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tibeer%2Fterraform-dyndns","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tibeer%2Fterraform-dyndns/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tibeer%2Fterraform-dyndns/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tibeer%2Fterraform-dyndns/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tibeer","download_url":"https://codeload.github.com/tibeer/terraform-dyndns/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tibeer%2Fterraform-dyndns/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260294455,"owners_count":22987622,"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":[],"created_at":"2024-12-15T02:46:52.579Z","updated_at":"2026-01-30T08:32:33.423Z","avatar_url":"https://github.com/tibeer.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Terraform DynDNS\n\nThis repo contains a terraform module to automatically update DNS entries with a dynamic IP (IPv4 and IPv6). Terraform is executed as a cron-job periodically.\n\nIn my case, I use AWS for my DNS records. Therefore the credentials have to be provided. As cron does not read environment variables, I have to pass them directly inside the cron-job definition. Not an elegant solution, but it works. Happy to implement improvements, if you have any!\n\n## Two possible setup paths\n\n### non-docker\n\nAllows __IPv4 and IPv6__ updates. Just copy the content of the _code_ folder somewhere and adopt the cron job accoringly.\nOf course you can also place your aws credentials in the _~/.aws/config_ and _~/.aws/credentials_ files.\n\n#### Example cron job for non-docker\n\nThe example below would execute terraform at the top of every hour.\n\n```sh\n0 * * * * AWS_ACCESS_KEY_ID=XXXX AWS_SECRET_ACCESS_KEY=XXXX AWS_DEFAULT_REGION=\"eu-central-1\" /usr/local/bin/terraform -chdir=/code apply -auto-approve || /terraform -chdir=/code init\n```\n\nIf you want to debug your cron-job use something like this:\n\n```sh\n0 * * * * AWS_ACCESS_KEY_ID=XXXX AWS_SECRET_ACCESS_KEY=XXXX AWS_DEFAULT_REGION=\"eu-central-1\" /usr/local/bin/terraform -chdir=/code apply -auto-approve \u003e\u003e /code/terraform_crontab.log 2\u003e\u00261 || /terraform -chdir=/code init \u003e\u003e /code/terraform_crontab.log 2\u003e\u00261\n```\n\n### docker\n\nThe docker version has the nice benefit, that nothing has to be installed on your system if you are already using docker.\nThe turnside of this method is, that you __can only update IPv4 entries__, as docker only natively uses only IPv4 (and NAT accordingly).\nAs shown in the _docker-compose.yml_ file, two directories need to be mounted:\n\n_code_ contains your terraform code. Feel free to adopt this to your needs.\n\n_jobs_ contains a single file `dyndns` which unfortunately has to be named exactly like that.\nIf this does not work, it'll trigger a `terraform init`. The default cronjob is set to run every minute. Due to the\ncircle-dependency inside the _Dockerfile_ this will result in the following steps:\n\n1. The container is spawned\n2. The first cronjob execution at the top of the minute is running `crontab /etc/cron.d/dyndns` to \"self-bootstrap\" the new mounted file from the jobs directory\n3. The second cronjob execution at the top of the minute is trying to run `terraform apply -auto-approve` which fails and instead runs `terraform init` therefore\n4. The third cronjob execution at the top of the minute finally succeeds in executing `terraform apply -auto-approve`.\n\nAs you might notice, it might happen that you have to wait approxiametly __three minutes__ until the first apply is triggered.\nFeel free to improve this for your purposes!\n\n#### Example cron job for docker\n\nThe example below would execute terraform at the top of every hour.\n\n```sh\n0 * * * * /terraform -chdir=/code apply -auto-approve || /terraform -chdir=/code init\n```\n\nIf you want to debug your cron-job use something like this:\n\n```sh\n0 * * * * /terraform -chdir=/code apply -auto-approve \u003e\u003e /code/terraform_crontab.log 2\u003e\u00261 || /terraform -chdir=/code init \u003e\u003e /code/terraform_crontab.log 2\u003e\u00261\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftibeer%2Fterraform-dyndns","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftibeer%2Fterraform-dyndns","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftibeer%2Fterraform-dyndns/lists"}