Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for source_content in azurerm_storage_share_file #9927

Open
amasover opened this issue Dec 17, 2020 · 7 comments
Open

Support for source_content in azurerm_storage_share_file #9927

amasover opened this issue Dec 17, 2020 · 7 comments

Comments

@amasover
Copy link
Contributor

Community Note

  • Please vote on this issue by adding a 馃憤 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Thanks to the maintainers/implementers for your hard work on azurerm_storage_share_file! It would be nice to also have a source_content argument to define files inline, similar to azurerm_storage_blob.

New or Affected Resource(s)

  • azurerm_storage_share_file

Potential Terraform Configuration

resource "azurerm_storage_share_file" "example" {
  name             = "my-shopping-list.txt"
  storage_share_id = azurerm_storage_share.example.id
  source_content   = <<-EOT
    My shopping list:
    * eggs
    * bananas
    * kiwis
    * milk tea
  EOT
}

References

@Kukunin
Copy link

Kukunin commented Feb 8, 2021

This feature would allow rendering templates in to share files

@hterik
Copy link
Contributor

hterik commented Sep 16, 2021

See hashicorp/terraform#17008 (comment) and hashicorp/terraform#21308 on why using tempfile for scenarios like this will likely not be supported, and why providers should prefer source_content over source-path.

@edvardvb
Copy link

edvardvb commented Apr 3, 2023

Are there any plans to support this? :)

We need to create the files from templates, and we can't store the content in version control, so we currently have to provision a local file via templatefile to a git-ignored folder, which leads to a convoluted workflow with a lot of unnecessary and noisy diffs.

The opportunity to use templatefile and pass it directly as the source to this resource would reduce complexity a lot for us!

@FakieHeelflip
Copy link

Sadly I recognize no effort to implement this feature. Are there any plans to support this?

@NSimpragaVolur
Copy link

NSimpragaVolur commented Nov 30, 2023

Same need here - I got a lot of configuration files I volume-mount to my containers using azurerm_storage_share_file.

The configuration files live in version control as .tpl templates, and it would be awesome if azurerm_storage_share_file supported source_content, because as it stands now I need to create a local_sensitive_fileon the runner before I can upload it to the azurerm_storage_share_file.

This, as was previously said, creates a lot of noisy diffs and introduces complexity into the workflow! With the source_content, the configuration files can be created directly from the data.template_file's rendered property, instead of the local_sensitive_file.

@lkurzyniec
Copy link

As a workaround, I'm using external, as follows:

data "external" "supply_variables" {
  program = [
    "bash",
    "${path.module}/supply-variables.sh",
  ]

  query = {
    env          = "dev"
    module_path  = path.module
  }
}
#!/bin/bash
set -e

eval "$(jq -r '@sh "ENV=\(.env) MODULE_PATH=\(.module_path)"')"

source_path="$MODULE_PATH/some-template.josn"
destination_path="$MODULE_PATH/some-template-supplied.json"
cp -f "$source_path" "$destination_path"

env_token='${env}'
sed -i "s|$env_token|$ENV|" $destination_path

jq -n --arg path "$destination_path" '{"result_file_path":$path}'
resource "azurerm_storage_share_file" "share_file" {
  name             = "some-config.json"
  storage_share_id = azurerm_storage_share.this.id
  source           = data.external.supply_variables.result.result_file_path
}

@syepes
Copy link

syepes commented Feb 4, 2024

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants