hashicorp / terraform-provider-local

Utility provider used to manage local resources, such as creating files.
https://registry.terraform.io/providers/hashicorp/local/latest
Mozilla Public License 2.0
213 stars 66 forks source link

Create local sensitive file error - permission denied #242

Open kubiaki opened 1 year ago

kubiaki commented 1 year ago

Terraform CLI and Provider Versions

Terraform v1.4.6 on darwin_arm64

Terraform Configuration

data "google_secret_manager_secret_version" "certificate_crt" {
  secret = "projects/11111111111/secrets/certificate_crt"
}

resource "local_sensitive_file" "certificate_crt" {
  filename = "/etc/ssl/certificate.crt"
  content = data.google_secret_manager_secret_version.certificate_crt.secret_data
  file_permission = "0640"
  directory_permission = "0750"
}

Expected Behavior

Terraform will perform the following actions:

local_sensitive_file.certificate_crt will be created

Actual Behavior

│ Error: Create local sensitive file error │ │ with local_sensitive_file.certificate_crt, │ on main.tf line 34, in resource "local_sensitive_file" "certificate_crt": │ 34: resource "local_sensitive_file" "certificate_crt" { │ │ An unexpected error occurred while writing the file │ │ +Original Error: open /etc/ssl/certificate.crt: permission denied

Steps to Reproduce

  1. terraform plan
  2. terraform apply

How much impact is this issue causing?

High

Logs

No response

Additional Information

No response

Code of Conduct

tristanmorgan commented 1 year ago

What user is terraform running under? /etc/ssl would normally be owned by root.