https://pulumi.com logo
#general
Title
# general
f

fancy-magazine-29876

01/11/2019, 5:26 PM
looking to move application specific infra to their respective repos but need to maintain environment separation in all cases
m

microscopic-florist-22719

01/11/2019, 5:28 PM
Even if you're not using k8s, it gives an example of a layered infrastructure with each layer represented as a stack
Can you go into more detail on what you mean by "environment separation"?
f

fancy-magazine-29876

01/11/2019, 5:30 PM
a lot of times, there are some differences between what gets deployed in staging vs prod just because of the nature of things (i.e. no staging kinesis streams at the moment)
is a stack per env the de-facto approach?
so
Pulumi.<env>.yaml
would contain flags, etc to say what to create?
and what if i wanted to deploy staging to a new AWS region - do I need to create a new stack?
i think i'm just going to have to play around with it for a while to see how things fit - thanks for the quick initial reply
m

microscopic-florist-22719

01/11/2019, 6:55 PM
np--sorry for falling off immediately afterwards.
given what you've described, it sounds like you do want a stack per environment
internally, we do this for our own infrastructure: our testing, staging, and prod environments each have their own stack
what is created and where is managed by the stack's configuration
👍 1
f

fancy-magazine-29876

01/11/2019, 7:04 PM
thanks! need to spend some time converting from TF and organizing
will let you guys know if i have more questions at that point
g

gentle-diamond-70147

01/11/2019, 8:31 PM
Depending on how much Terraform you're converting, https://github.com/pulumi/tf2pulumi can be really helpful - in case you weren't aware of it.
f

fancy-magazine-29876

01/11/2019, 8:35 PM
ya i did use that, but it's proving difficult as it doesn't support a lot of the variable syntaxes
so i've only been able to convert a small subset of code
g

gentle-diamond-70147

01/11/2019, 8:37 PM
So not supporting some terraform functions? Or something different from that?
f

fancy-magazine-29876

01/11/2019, 8:39 PM
like path variables
some of the null resources i could just delete
g

gentle-diamond-70147

01/11/2019, 8:40 PM
Gotcha.
f

fancy-magazine-29876

01/11/2019, 8:40 PM
i'm also getting panics every other time i run it if there's an error where the error is not actually printed
Copy code
whobbs:~/projects/infra-convert/staging/convert$ tf2pulumi > ~/projects/infra-pulumi-ts/staging-uw2.ts
2019/01/11 13:40:15 [TRACE] module source: "../../modules/api_gateway"
2019/01/11 13:40:15 [TRACE] module source: "../../modules/efs"
2019/01/11 13:40:15 [TRACE] module source: "../../modules/sqs"
2019/01/11 13:40:15 [TRACE] module source: "../../modules/s3-static-site"
2019/01/11 13:40:15 [TRACE] module source: "../../modules/s3-static-site"
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x1caed1f]
running it again shows the problem:
Copy code
importing Terraform project graphs: aws_iam_policy.site_deployer_policy.policy: could not find plugin terraform-template for provider template;
g

gentle-diamond-70147

01/11/2019, 8:47 PM
The
-allow-missing-plugins
flag will allow it to continue past that, if you wanted to try that.
@microscopic-florist-22719 any thoughts on the panic?
f

fancy-magazine-29876

01/11/2019, 8:51 PM
ok cool - it's really these ones that are a bit ambiguous:
Copy code
error: importing Terraform project graphs: aws_iam_user_policy.user-iam-policy.name: NYI: terraform variables
from that i can deduce what resource it's coming from but don't know which variable is causing the issue
somewhat minor usability issue
m

microscopic-florist-22719

01/11/2019, 9:42 PM
ah, it looks like you're using
terraform.
variables
not sure about the panic... @fancy-magazine-29876, do you have a more complete stack trace?
f

fancy-magazine-29876

01/11/2019, 9:46 PM
welp, can't do snippets in a slack thread i guess...
https://pastebin.com/ukTT1WyV @microscopic-florist-22719
m

microscopic-florist-22719

01/11/2019, 9:48 PM
Ah, I see what's happening here.
It looks like you have locals that refer to other locals
f

fancy-magazine-29876

01/11/2019, 9:48 PM
very likely
terraform forces a lot of hacks
m

microscopic-florist-22719

01/11/2019, 9:49 PM
this is definitely a bug in
tf2pulumi
. I'll write up an issue
👍 1