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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

widdix list returns stack list with correct "Template ID" but empty "Template Version" and "Template Drift" #1

Closed
lestephane opened this issue Sep 12, 2018 · 4 comments

Comments

@lestephane
Copy link

I've used the widdix 6.18.0 static website templates, and wanted to update to the latest 7.x.

So i ran

widdix list

in order to run

widdix update

The output of widdix list does not seem to show the template version and drift information

-------------------------------------------------------------------------------------------------------------------------------------------
| Stack Account   | Stack Region  | Stack Name                | Template ID                       | Template Version   | Template Drift   |
-------------------------------------------------------------------------------------------------------------------------------------------
| myaccount       | us-east-1     | myaccount-website-stack   | static-website/static-website     |                    |                  |
| myaccount       | us-east-1     | myaccount-zone-stack      | vpc/zone-public                   |                    |                  |
-------------------------------------------------------------------------------------------------------------------------------------------

What makes widdix 'see' the template version? I get them using a terraform http data source.

locals {
  widdix_cf_templates_version = "v6.18.0"
  widdix_cf_templates_url = "https://raw.githubusercontent.com/widdix/aws-cf-templates/${local.widdix_cf_templates_version}"
}

data "http" "zone" {
  url = "${local.widdix_cf_templates_url}/vpc/zone-public.yaml"
}

data "http" "website" {
  url = "${local.widdix_cf_templates_url}/static-website/static-website.yaml"
}
@lestephane
Copy link
Author

lestephane commented Sep 12, 2018

Fetching the template from github instead of the official S3 release location was the cause.

I notice, however, that the content-type when fetching them over HTTP is not a text/* content-type, causing the terraform http provider to fail anyway.

$ wget --header "Accept: text/plain" --server-response https://s3-eu-west-1.amazonaws.com/widdix-aws-cf-templates-releases-eu-west-1/v6.18.0/vpc/zone-public.yaml
--2018-09-12 14:54:58--  https://s3-eu-west-1.amazonaws.com/widdix-aws-cf-templates-releases-eu-west-1/v6.18.0/vpc/zone-public.yaml
Resolving s3-eu-west-1.amazonaws.com (s3-eu-west-1.amazonaws.com)... 52.218.49.28
Connecting to s3-eu-west-1.amazonaws.com (s3-eu-west-1.amazonaws.com)|52.218.49.28|:443... connected.
HTTP request sent, awaiting response... 
  HTTP/1.1 200 OK
  x-amz-id-2: DXs4d7et7gOwDP0hjwznhbuJuHmkDhqG/WwZJnxI4k4ll++b66YtlTqYW7WRPbDDhwAsrjfF6ks=
  x-amz-request-id: 8824F61FAD136314
  Date: Wed, 12 Sep 2018 12:55:00 GMT
  Last-Modified: Thu, 19 Jul 2018 07:17:44 GMT
  ETag: "b02fcb2bf67eb28f68407101ef59ce69"
  Accept-Ranges: bytes
  Content-Type: binary/octet-stream <<<<<<<<<<<<<<<<<<<< Not a text/* content type
  Content-Length: 1662
  Server: AmazonS3
Length: 1662 (1,6K) [binary/octet-stream]

The error in terraform when using the s3 location (for completeness):

* data.http.website: data.http.website: Content-Type is not a text type. Got: binary/octet-stream

@michaelwittig
Copy link
Contributor

The releases are stored on S3 (as you figured out) and only released templates contain a proper version number. That's why the tool can not display the version number and also can not check if the deployed template is the same as the released one.

Regarding the content type issue, we use aws s3 sync to upload the templates to s3. It looks like that aws s3 sync is not able to guess the mimetype of yaml files because the python library used does not support it.

$ python
>>> mimetypes.guess_type("test.yaml")
(None, None)
>>> mimetypes.guess_type("test.yml")
(None, None)
>>> mimetypes.guess_type("test.json")
('application/json', None)
>>> 

I was also looking for the correct mimetype which seems to be a open question.

So I'm not quiet sure how to proceed here. We could hard code the Content-Type to some mimetype, the question is which one we should choose :)

@michaelwittig
Copy link
Contributor

I close this issue and created a new one in the templates repo since this issue is not related to the CLI: widdix/aws-cf-templates#196

@lestephane
Copy link
Author

lestephane commented Sep 13, 2018 via email

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

No branches or pull requests

2 participants