diff --git a/modules/aws-ec2/main.tf b/modules/aws-ec2/main.tf index e879a33..be730aa 100644 --- a/modules/aws-ec2/main.tf +++ b/modules/aws-ec2/main.tf @@ -107,13 +107,14 @@ resource "local_sensitive_file" "private_key" { filename = "${path.module}/ssh/id_rsa" } -# resource "null_resource" "set_permission" { -# depends_on = [local_sensitive_file.private_key] -# -# provisioner "local-exec" { -# command = "chmod 0600 ${local_sensitive_file.private_key.filename}" -# } -# } +# Only use this resource if you are using Linux or MacOS +resource "null_resource" "set_permission" { + depends_on = [local_sensitive_file.private_key] + + provisioner "local-exec" { + command = "chmod 0600 ${local_sensitive_file.private_key.filename}" + } +} resource "local_file" "public_key" { content = tls_private_key.ssh_key.public_key_openssh diff --git a/modules/aws-ec2/readme.md b/modules/aws-ec2/readme.md index d56b359..6c52968 100644 --- a/modules/aws-ec2/readme.md +++ b/modules/aws-ec2/readme.md @@ -34,7 +34,7 @@ tofu init cp .env.example .env ``` -6. Modify the `.env` and `variables.tf` file according to your needs. You can modify `DOMAIN` to your own domain, this will be used to generate SSL certificate by [Caddy](https://caddyserver.com/). If you want to configure your own certs instead of automatic HTTPS, you can leave `caddy` blank. +6. Modify the `.env` and `variables.tf` file according to your needs. You can modify `DOMAIN` to your own domain, this will be used to generate SSL certificate by [Caddy](https://caddyserver.com/). If you want to configure your own certs instead of automatic HTTPS, you can leave `caddy` blank, you should also check `main.tf` file to make sure it works with your OS. 7. Deploy the project ```bash