So I've been working in sparkleformation and had this issue pop up even though all my files exist:
[WARN]: No local SparkleFormation files detected
[ERROR]: Failed to locate any templates!
[FATAL]: Invalid formation file path provided:
ERROR: IOError: Failed to locate file:
I wanted to create this question for future reference. This is what happens if you create a sparkleformation template and place any code outside of the Sparkleformation.new block. For example this would cause the above failure:
yamlfile = YAML.load_file(ENV['YAMLFILE_YML_PATH'])
SparkleFormation.new(:somename, :provider => :aws).load(:base).overrides do
yamlfile.keys.each { |key| yamlfile[key.to_sym] = yamlfile.delete(key)}
dynamic!(:someother name, :test_eips, yamlfile)
end
This will work:
SparkleFormation.new(:somename, :provider => :aws).load(:base).overrides do
yamlfile = YAML.load_file(ENV['YAMLFILE_YML_PATH'])
yamlfile.keys.each { |key| yamlfile[key.to_sym] = yamlfile.delete(key)}
dynamic!(:someother name, :test_eips, yamlfile)
end
Related
I have a default tags block and would like to add new tags showing the TG and TF versions used in deployment.
I assumed this would work, but I was wrong..
locals {
terraform_version = "${run_cmd("terraform --version")}"
terragrunt_version = "${run_cmd("terragrunt --version")}"
}
provider "aws" {
default_tags {
tags = {
terraform_version = local.terraform_version
terragrunt_version = local.terragrunt_version
}
}
}
I'm sure there's a simple way to do this, but it alludes me.
Here's the error message:
my-mac$ terragrunt apply
ERRO[0000] Error: Error in function call
ERRO[0000] on /Users/me/git/terraform/environments/terragrunt.hcl line 8, in locals:
ERRO[0000] 8: terraform_version = "${run_cmd("terraform --version")}"
ERRO[0000]
ERRO[0000] Call to function "run_cmd" failed: exec: "terraform --version": executable file not found in $PATH.
ERRO[0000] Encountered error while evaluating locals in file /Users/me/git/terraform/environments/terragrunt.hcl
ERRO[0000] /Users/me/git/terraform/environments/terragrunt.hcl:8,31-39: Error in function call; Call to function "run_cmd" failed: exec: "terraform --version": executable file not found in $PATH.
ERRO[0000] Unable to determine underlying exit code, so Terragrunt will exit with error code 1
The run_cmd function uses separate parameters for the command to run and the args to pass. Your example tries to run the command "terraform --version" and not terraform --version. You should update your code like the following:
locals {
terraform_version = "${run_cmd("terraform", "--version")}"
terragrunt_version = "${run_cmd("terragrunt", "--version")}"
}
Building on jordanm's good work, I found the TG version was good but I needed to remove some verbosity in the TF output for it to be usable as an aws tag.
locals {
terraform_version = "${run_cmd("/bin/bash", "-c", terraform --version | sed 1q")}"
terragrunt_version = "${run_cmd("terragrunt", "--version")}"
}
Good work everybody!
If i try to run the below command:
./target/release/node-template build-spec --chain staging > stagingSpec.json
facing the below error:
Error: Input("Error opening spec file: No such file or directory (os error 2)")
Is there any guide how to use that staging flag??
Here are the rustdocs for the command, and it's implementation in the node template - this looks for specific from your chain specification file based on what you pass that is configued. In the template at the time of writing, the template only has dev and "everything else" mode:
fn load_spec(&self, id: &str) -> Result<Box<dyn sc_service::ChainSpec>, String> {
Ok(match id {
"dev" => Box::new(chain_spec::development_config()?),
"" | "local" => Box::new(chain_spec::local_testnet_config()?),
path =>
Box::new(chain_spec::ChainSpec::from_json_file(std::path::PathBuf::from(path))?),
})
}
Thus you would need to specify another in/node/src/chainspec.rs and configure the /node/src/commnad.rs to use the correct one when called.
I'm running the latest google provider and trying to use the example terraform registry code to create a log sink. However the exclusion block is unrecognized
I keep getting 'An argument named "exclusions" is not expected here'
Any ideas on where I am going wrong?
resource "google_logging_project_sink" "log-bucket" {
name = "my-logging-sink"
destination = "logging.googleapis.com/projects/my-project/locations/global/buckets/_Default"
exclusions {
name = "nsexcllusion1"
description = "Exclude logs from namespace-1 in k8s"
filter = "resource.type = k8s_container resource.labels.namespace_name=\"namespace-1\" "
}
exclusions {
name = "nsexcllusion2"
description = "Exclude logs from namespace-2 in k8s"
filter = "resource.type = k8s_container resource.labels.namespace_name=\"namespace-2\" "
}
unique_writer_identity = true
Showing that the version of Google provider is at the stated version in the comment below
$ terraform version
Terraform v0.12.29
+ provider.datadog v2.21.0
+ provider.google v3.44.0
+ provider.google-beta v3.57.0
Update: Have also tried 0.14 of Terraform and that makes no difference.
Error: Unsupported block type
on ..\..\..\..\modules\krtyen\datadog\main.tf line 75, in module "export_logs_to_datadog_log_sink":
75: exclusions {
Blocks of type "exclusions" are not expected here.
Releasing state lock. This may take a few moments...
[terragrunt] 2021/02/22 11:11:20 Hit multiple errors:
exit status 1
You have to upgrade you google provided. exclusions block has been added in version v3.44.0:
logging: Added support for exclusions options for google_logging_project_sink
I need to include res-client into my module in order to use RestClient::Resource.
I use the method in the module in a Chef recipe (ruby_block resource).
When my ruby_block resource tries to run the method in the module it output this error:
ERROR: cannot load such file -- rest-client
The following is my module residing in libraries folder:
module SecretServer
def fetch_token
payload = { :username => "***", :password => "***", :grant_type => "****"}
uri = ***
request = RestClient::Resource.new(uri, :verify_ssl => false)
post_request = request.post payload, :content_type => 'application/x-www-form-urlencoded'
token = JSON.parse(post_request)["access_token"]
return token
end
end
require 'rest-client'
Chef::Recipe.include(SecretServer)
Chef::Resource.include(SecretServer)
The following is the resource that calls the function in module:
ruby_block 'parse data' do
block do
res = fetch_token
puts res
end
end
This is just one of the several recipes in my cookbook. This recipe runs after the target node is almost ready and 'bundle install' has been run on the target node.
I also install rest-client in the target node. I tried each of following resource before my ruby_block resource:
chef_gem 'rest-client' do
action :install
end
gem_package 'rest-client' do
action :install
end
My question is how to include 'rest-client' and utilize it in Chef recipes?
Long ago, the HTTP clients lived together in harmony. Then everything changed when the JSON gem attacked. Only the Chef::HTTP was still to be included with Chef as all the other clients were under too much flux to include.
We don't include that gem anymore, so to use it, you would have to install it yourself either via a cookbook gem dependency or a chef_gem resource. But for simple stuff you can just use our Chef::HTTP::SimpleJSON client instead:
Chef::HTTP::SimpleJson.new(uri).post("", args)["access_token"]
Or something like that (specifics depend on if you must use form encoding or if the server also speaks JSON).
this is the terraform I am using.
provider "google" {
credentials = "${file("${var.credentials}")}"
project = "${var.gcp_project}"
region = "${var.region}"
}
resource "google_dataflow_job" "big_data_job" {
#name = "${var.job_name}"
template_gcs_path = "gs://dataflow-templates/wordcount/template_file"
#template_gcs_path = "gs://dataflow-samples/shakespeare/kinglear.txt"
temp_gcs_location = "gs://bucket-60/counts"
max_workers = "${var.max-workers}"
project = "${var.gcp_project}"
zone = "${var.zone}"
parameters {
name = "cloud_dataflow"
}
}
But I am getting this error.so how can i solve this problem:-
enter code here Error: Error applying plan:
1 error(s) occurred:
* google_dataflow_job.big_data_job: 1 error(s) occurred:
* google_dataflow_job.big_data_job: googleapi: Error 400: (4ea5c17a2a9d21ab): The workflow could not be created. Causes: (4ea5c17a2a9d2052): Found unexpected parameters: ['name' (perhaps you meant 'appName')], badRequest
Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.
In your code you've commented out the name argument, but name is required for this resource type.
Remove the leading # from this line
#name = "${var.job_name}"
You've also included name as a parameter to the dataflow template, but that example wordcount template does not have a name parameter, it only has inputFile and output:
inputFile The Cloud Storage input file path.
output The Cloud Storage output file path and prefix.
Remove this part:
parameters {
name = "cloud_dataflow"
}