Capgemini / kubeform

Form your :boat: Kubernetes :anchor: cluster anywhere using CoreOS, Terraform and Ansible
https://capgemini.github.io/kubeform
MIT License
326 stars 57 forks source link

utf8 encoding issue with terraform/aws/public-cloud/*.tf files #162

Open cmcconnell1 opened 8 years ago

cmcconnell1 commented 8 years ago

Hello, I tried to push my fixes in my local branch (and would then do a PR) but don't have access to push to your kubeform repo.

This is regarding kubeform and a blocker with terraform get to download and update modules

When trying to follow the kubeform doc and do a 'terraform get' Get 'Error loading kubeform/terraform/aws/public-cloud/masters.tf: Error reading config for template_file[master_cloud_init]: parse error: syntax error'

For me on both MacOS and CentOS linux It appears as perhaps the syntax / encoding is incorrect and fails on every .tf file if present

Solution worked for me: I converted all of the terraform .tf files via UTF8 encode BTW just used this site (http://www.cafewebmaster.com/online_tools/utf8_encode)

kubeform/terraform/aws/public-cloud $ ls -lat *.tf -rw-r--r-- 1 cmcc staff 2389 Sep 9 10:27 workers.tf -rw-r--r-- 1 cmcc staff 2525 Sep 9 10:26 masters.tf -rw-r--r-- 1 cmcc staff 6485 Sep 9 10:26 main.tf -rw-r--r-- 1 cmcc staff 2469 Sep 9 10:25 edge-routers.tf

Note that after converting all above .tf files to utf8 encoding I was then was able to re-run 'terraform get' which got further along but failed again when it encountered another problematic .tf file: .terraform/modules/343c43072a8336916caae1b54b403824/main.tf

full terminal output below:

cmcc@makena:~/GIT/kubeform/terraform/aws/public-cloud $ terraform get Get: git::https://github.com/terraform-community-modules/tf_aws_virttype.git Get: git::https://github.com/terraform-community-modules/tf_aws_coreos_ami.git Get: file:///Users/cmcc/GIT/kubeform/terraform/aws/keypair Get: git::https://github.com/Capgemini/tf_tls.git Get: git::https://github.com/Capgemini/tf_tls.git Get: git::https://github.com/Capgemini/tf_tls.git Get: git::https://github.com/Capgemini/tf_tls.git Get: git::https://github.com/Capgemini/tf_tls.git Get: git::https://github.com/Capgemini/tf_tls.git Get: git::https://github.com/Capgemini/tf_tls.git Get: git::https://github.com/terraform-community-modules/tf_aws_igw.git Get: git::https://github.com/terraform-community-modules/tf_aws_public_subnet.git Get: file:///Users/cmcc/GIT/kubeform/terraform/aws/sg-all-traffic Get: file:///Users/cmcc/GIT/kubeform/terraform/aws/iam Error loading Terraform: Error downloading modules: module iam: Error loading .terraform/modules/343c43072a8336916caae1b54b403824/main.tf: Error reading config for aws_iam_role[master_role]: parse error: syntax error

So following the same process noted above and I converted .terraform/modules/343c43072a8336916caae1b54b403824/main.tf to utf8_encode and I was again able to continue and re-run 'terraform get' where it continued and got farhter still but failed with Error loading Terraform: module edge-router_ami.root: 1 error(s) occurred:

full shell output below:

$ terraform get Get: git::https://github.com/terraform-community-modules/tf_aws_virttype.git Get: git::https://github.com/terraform-community-modules/tf_aws_coreos_ami.git Get: file:///Users/cmcc/GIT/kubeform/terraform/aws/keypair Get: git::https://github.com/Capgemini/tf_tls.git Get: git::https://github.com/Capgemini/tf_tls.git Get: git::https://github.com/Capgemini/tf_tls.git Get: git::https://github.com/Capgemini/tf_tls.git Get: git::https://github.com/Capgemini/tf_tls.git Get: git::https://github.com/Capgemini/tf_tls.git Get: git::https://github.com/Capgemini/tf_tls.git Get: git::https://github.com/terraform-community-modules/tf_aws_igw.git Get: git::https://github.com/terraform-community-modules/tf_aws_public_subnet.git Get: file:///Users/cmcc/GIT/kubeform/terraform/aws/sg-all-traffic Get: file:///Users/cmcc/GIT/kubeform/terraform/aws/iam Get: git::https://github.com/terraform-community-modules/tf_aws_virttype.git Get: git::https://github.com/terraform-community-modules/tf_aws_coreos_ami.git Get: file:///Users/cmcc/GIT/kubeform/terraform/aws/elb Get: git::https://github.com/terraform-community-modules/tf_aws_virttype.git Get: git::https://github.com/terraform-community-modules/tf_aws_coreos_ami.git Error loading Terraform: module edge-router_ami.root: 1 error(s) occurred:

Here is what seems to be the problem--my changes below after converting the files to utf8 encoding in my local 'feature/fix' branch:

git diff masters.tf diff --git a/terraform/aws/public-cloud/masters.tf b/terraform/aws/public-cloud/masters.tf index 7f6668b..eef2d53 100644 --- a/terraform/aws/public-cloud/masters.tf +++ b/terraform/aws/public-cloud/masters.tf @@ -17,9 +17,9 @@ resource "template_file" "master_cloud_init" { etcd_discovery_url = "${file(var.etcd_discovery_url_file)}" size = "${var.masters}" region = "${var.region}"

git diff ../iam/main.tf diff --git a/terraform/aws/iam/main.tf b/terraform/aws/iam/main.tf index 64079a2..84a9fe3 100644 --- a/terraform/aws/iam/main.tf +++ b/terraform/aws/iam/main.tf @@ -2,13 +2,13 @@ resource "aws_iam_role" "master_role" { name = "master_role" path = "/"