-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore/nixify terra #10
base: main
Are you sure you want to change the base?
Conversation
this changes not breaking our workflow: * nix-shell refer to shell.nix * nix develop refer to flake.nix#devShells * TODO: rewrite *.tf to .nix
6516001
to
49d7eb2
Compare
) | ||
{ | ||
src = ./.; | ||
}).shellNix |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you want to changes shell, please update in flake.nix at attribute devShell that run same function as before in shell.nix (mkShell).
@faultables could you continue this branch ? |
gw pelajari tentang terranix dulu since both hcl and nix offer declarative configuration but with their own dsl |
tantangannya ini kita pakai atlantis yg technically cuma buat jalanin |
@faultables berarti kita commit aja hasil generated dari terranix, outputnya itu
|
|
||
# nix flake check | ||
checks = { | ||
pre-commit-check = pre-commit-hooks.lib.${system}.run { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Example pre-commit @faultables
@@ -0,0 +1 @@ | |||
{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's a file will be used for terraform apply
@faultables
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{}
bakalan terisi berdasarkan modules = []
pada flake.nix:31:33 @faultables
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nah eventually harus jalanin nix build
ini somewhere kan (local/CI/atlantis server)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@faultables development mode generated config.tf.json trus push ke repository ini.
atlantis referensinya kerepo ini. so, terraform apply
jadi possible diatlantis.
ok gimme a sec |
@faultables yes, in |
itu dia gan unless kita ga buat symlink. jadi harus: a) run nix-build(1) di local |
c) itu mksdnya gimana @faultables |
klo rewrite *.tf ke *.nix pakai terranix, berarti si untuk generate klo di CI, ini kita bisa ga perlu pakai atlantis, dan klo jalanin nix-build nya di server tempat atlantis jalan, ini cuma butuh setup si server tersebut bisa pakai flake, dan setup prehook untuk atlantis sebelum dia melakukan pekerjaannya (e.g jalanin |
gw coba ajarin atlantis buat pakai terranix |
atlantis plan |
1 similar comment
atlantis plan |
Ran Plan for dir: /root/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/etc/atlantis/.atlantis/bin
warning: Git tree '/etc/atlantis/.atlantis/repos/evilfactorylabs/area13/10/area13' is dirty
No changes. Your infrastructure matches the configuration.
Terraform has compared your real infrastructure against your configuration
and found no differences, so no changes are needed.
|
defaultnya bakal generate |
@faultables check comment ini #10 (comment) |
Ran Plan for dir: Plan Error Show Output
|
Ran Plan for dir: warning: Git tree '/etc/atlantis/.atlantis/repos/evilfactorylabs/area13/10/area13' is dirty
warning: Git tree '/etc/atlantis/.atlantis/repos/evilfactorylabs/area13/10/area13' is dirty
this derivation will be built:
/nix/store/cwvgwc1jfwxfgxg5ki450j0ir0wpl656-apply.drv
building '/nix/store/cwvgwc1jfwxfgxg5ki450j0ir0wpl656-apply.drv'...
No changes. Your infrastructure matches the configuration.
Terraform has compared your real infrastructure against your configuration
and found no differences, so no changes are needed.
|
Ran Plan for dir: Plan Error Show Output
|
Ran Plan for dir: Show Outputwarning: Git tree '/etc/atlantis/.atlantis/repos/evilfactorylabs/area13/10/area13' is dirty
this derivation will be built:
/nix/store/607rwwzq15wjmqrvc5z9np3xcghwgr0y-config.tf.json.drv
building '/nix/store/607rwwzq15wjmqrvc5z9np3xcghwgr0y-config.tf.json.drv'...
warning: Git tree '/etc/atlantis/.atlantis/repos/evilfactorylabs/area13/10/area13' is dirty
this derivation will be built:
/nix/store/5wlq1bl5lrm4vprhm7xz9nim3lwmbjq2-apply.drv
building '/nix/store/5wlq1bl5lrm4vprhm7xz9nim3lwmbjq2-apply.drv'...
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# digitalocean_vpc.dummy_sgp will be created
+ resource "digitalocean_vpc" "dummy_sgp" {
+ created_at = (known after apply)
+ default = (known after apply)
+ id = (known after apply)
+ ip_range = "10.105.69.0/20"
+ name = "dummy-sgp"
+ region = "sgp1"
+ urn = (known after apply)
}
Plan: 1 to add, 0 to change, 0 to destroy.
|
not bad |
@faultables command |
gw pengen strukturnya direktorinya kek gini:
jadi di flake.nix nya kek gini misalnya:
|
Replied for #10 (comment) @faultables Bisa aja |
terraform init harusnya |
nice |
jan lupa rebase banyak commit messages keramat |
LOL kita bisa bikin over nix dan hanya jalanin
sisa masukin filePath nya (seperti digambar) |
ga sesimple itu kek nya ada manage lock state or something
gw ga tau cara kek import dns as do_dns from './digitalocean/dns.nix'
import vpc as do_vpc from './digitalocean/vpc.nix' |
Kenapa harus dibuat ekspektasi di |
klo misalnya nix handle collision (e.g bisa define sebagai dict yg mana |
contoh digitalocean dan linode dong ? @faultables |
itu yg pakai prefix |
ini blocker nya apa ya? karena ini nge-block #11 |
atlantis unlock |
All Atlantis locks for this PR have been unlocked and plans discarded |
*.nix
files in commit*.tf
files in commitconfig.tf.json
Commands Based on
flake.nix
nix build
import modules
nix run .#build
result
toconfig.tf.json
nix run .#apply
terraform init && terraform apply
and generated (when nothing)config.tf.json
nix run .#destroy
terraform init && terraform destroy
and generated (when nothing)config.tf.json
nix develop
(pure shell environment) - You don't need to setup anymore (seedevShells
inflake.nix
)nix develop -C $SHELL
- if you want to impure shell environment - which is mean area13 environment + your computer environment.