#terraform - July 2018

ag4ve
ag4veover 8 years ago
@ag4ve has joined the channel
zerocoolback
zerocoolbackover 8 years ago
@zerocoolback has joined the channel
Jonathan Olson
Jonathan Olsonover 8 years ago
@Jonathan Olson has joined the channel
achrstl
achrstlover 8 years ago
@achrstl has joined the channel
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
@Jamie Nelson (BitFlight) here’s the TF channel
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 8 years ago
@Jamie Nelson (BitFlight) has joined the channel
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
🦗
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 8 years ago
Oh hi! I can keep my terraform troubleshooting to here without disturbing your geodesic users :)
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
We can try - just sensitive to splintering off eyeballs until we have more critical mass
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
but it is nice to keep the threads separated
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago(edited)
yea, perhaps it’s time. just like we started using #random <--- nice
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 8 years ago
@Andriy Knysh (Cloud Posse) has joined the channel
tamsky
tamskyover 8 years ago
@tamsky has joined the channel
Cristin
Cristinover 8 years ago
@Cristin has joined the channel
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
@Cristin which module are you having trouble with?
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
(i'm about to jump on a call - so may be delayed in following up)
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
@Andriy Knysh (Cloud Posse) can also help
Cristin
Cristinover 8 years ago
I'm using elastic-beanstalk-environment and I'm getting some error related to aws_iam
Cristin
Cristinover 8 years ago
@Cristin uploaded a file: Untitled
Cristin
Cristinover 8 years ago
I took a look over the parameters and the code of the module, but I don't see a way of passing a aws_iam_role_policy_attachment or profile
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 8 years ago
@Cristin i’ll look into the error (little bit later), but for now you can look at this repo where we use elastic-beanstalk-environment: https://github.com/cloudposse/terraform-aws-jenkins/blob/master/main.tf
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 8 years ago
Cristin
Cristinover 8 years ago
I took a look over the example and how you are attaching a policy to the ec2 instances. I tried doing the same thing but I still get the above errors
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 8 years ago
@Cristin can you share your code? If not public, you can message me or send email to andriy@cloudposse.com, I’ll take a look
Cristin
Cristinover 8 years ago
@Cristin uploaded a file: Untitled
Cristin
Cristinover 8 years ago
@Andriy Knysh (Cloud Posse) Here it is ☝️
Cristin
Cristinover 8 years ago
Thank you!
Maarten van der Hoef
Maarten van der Hoefover 8 years ago
@Maarten van der Hoef has joined the channel
Cristin
Cristinover 8 years ago
@Andriy Knysh (Cloud Posse) I managed to make it work by using the configuration you used in the Jenkins example
Cristin
Cristinover 8 years ago
Thank you for you help!
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 8 years ago
@Cristin sorry I did not help you yet, just wanted to look at your code in more details (from what I saw briefly, you mixed a lot of concepts)
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 8 years ago
glad the jenkins examples hepled
Cristin
Cristinover 8 years ago
@Andriy Knysh (Cloud Posse) I still have one question. How is the best way of connecting the elasticbeanstalk envirment to a RDS database? Just create the database and inject in env vars the database connection details?
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 8 years ago
we have https://github.com/cloudposse/terraform-aws-rds to create an RDS database (no Aurora)
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 8 years ago
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 8 years ago
yes, the best way is to put the RDS credentials (username, password, etc.) in ENV vars, and then in Elastic Beanstalk environment add those ENV vars to the environment. Then read them in your app
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 8 years ago
(you can add any number of ENVs)
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 8 years ago
we try to follow 12-factor https://12factor.net/
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 8 years ago
III. Config
Store config in the environment
Cristin
Cristinover 8 years ago
Awesome, thank you for all this details 😄
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 8 years ago
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 8 years ago
it will output the credentials
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 8 years ago
at Cloud Posse, we use chamber to securily work with ENV vars and secrets
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 8 years ago
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 8 years ago(edited)
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 8 years ago
Cristin
Cristinover 8 years ago
Awesome information, thanks a lot!
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 8 years ago
geodesic supports chamber natively https://github.com/cloudposse/geodesic
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 8 years ago
when you provision an RDS cluster from geodesic, you add the ENVs to chamber
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 8 years ago
then you provision terraform-aws-elastic-beanstalk-environment from geodesic, you read the ENVs from chamber
krogebry
krogebryover 8 years ago
@krogebry has joined the channel
Cristin
Cristinover 8 years ago
@Andriy Knysh (Cloud Posse) Thank you for all the help! For now I setup a simple RDS postgress db an injected the env variables in a ebs env
Cristin
Cristinover 8 years ago
I still have a question, related to setting up multiple envs like "develop" and "production"
Cristin
Cristinover 8 years ago
I noticed that I can create one ebs application and create multiple environments for it
Cristin
Cristinover 8 years ago
But in this situation I don't understand what's the role of the stage attribute for the elastic_beanstalk_application module
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 8 years ago
stage is to separate the resources b/w diff stages - see the latest discussing in #announcements
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 8 years ago
also, by using diff stage, e.g. dev and prod, you can deploy the same environment two times for development and production
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 8 years ago
you need to deploy it two times obviously
Cristin
Cristinover 8 years ago
Yes, I know this. But if I have 1 application and 2 environments for it, what's the role of having stage setup on the application itself?
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
We generally do not prescribe using a single beanstalk for multiple stages even though it is supported
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 8 years ago
stage is used in all resource names by using the label module. So (almost) all resources will be names like namespace-stage-name
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 8 years ago
so, if you use the same AWS account and the same EB application to deploy two environments into it, then stage could be anything you like - but as @Erik Osterman (Cloud Posse) mentioned, we don’t usually do it
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 8 years ago
we try to completely separate stages
Cristin
Cristinover 8 years ago
Ok, I understand. So is a best practive to have 1 app = 1 env
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 8 years ago
even using diff AWS accounts for more security and control
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
Yes - that way they share nothing so making changes to one can never impact the other
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 8 years ago
and much easier to control IAM
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
Also, have you seen our modules for ECS
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
?
Cristin
Cristinover 8 years ago
Sorry, which one? I looked over a lot of your modules, they are really helpful 😄
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
Since you are starting from scratch, I would consider using ECS rather than Beanstalk.
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
Cristin
Cristinover 8 years ago
Well, the Beanstalk is actually a requirment on the project I'm doing, so I will try ecs on the next one 😄
Cristin
Cristinover 8 years ago
Ok, so if I will create seperate resources (security group, vpc, db, app, env) for each stage what would be the best way to run this twice and not having to duplicate the code? Should I create a module around your modules ?
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 8 years ago
@Cristin we still recommend to separate all resources into at lest two stages (dev and prod) and don’t mix anything b/w/ them
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 8 years ago
take a look how it’s separated here https://github.com/cloudposse/staging.cloudposse.co
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 8 years ago
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 8 years ago
we use ENV vars for stage too
Cristin
Cristinover 8 years ago
Ok, I will look into this. Thanks a lot again for your time and availability to help 🙂
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 8 years ago
no problem
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 8 years ago
the container + env vars pattern is our approach to DevOps orchestration and env separation (there could be other ways of doing it)
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 8 years ago
geodesic is that container, with much more tools inside
Yoann
Yoannover 8 years ago
@Yoann has joined the channel
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 8 years ago
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 8 years ago
@Erik Osterman (Cloud Posse) are we going to release that null-label branch we made together that adds context as a variable?
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
yea, i was just holding off since it was "complicated"
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
but we can merge
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago(edited)
@Jamie Nelson (BitFlight) do you want to add environment?
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
(in a follow up PR)
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 8 years ago
I did yeah :)
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago(edited)
Is his change by @dennybaa in that commit not needed?
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 8 years ago
He pushed his change through.... its in now
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
whoot!
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
so, one more test and then approve? 😃
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
(i can't approve, since I opened the PR)
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 8 years ago
I have just pushed the changes
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 8 years ago
I have updated the readme to include the new features too
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
tested and working?
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 8 years ago
yeah, using the example
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 8 years ago(edited)
./examples/complete
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
cool
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
ok, you can approve, merge, and tag a new minor release
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 8 years ago

 terraform apply                                                    [ruby-2.5.1p57]
data.null_data_source.tags_as_list_of_maps[5]: Refreshing state...
data.null_data_source.tags_as_list_of_maps[1]: Refreshing state...
data.null_data_source.tags_as_list_of_maps[0]: Refreshing state...
data.null_data_source.tags_as_list_of_maps[4]: Refreshing state...
data.null_data_source.tags_as_list_of_maps[3]: Refreshing state...
data.null_data_source.tags_as_list_of_maps[2]: Refreshing state...
data.null_data_source.tags_as_list_of_maps[0]: Refreshing state...
data.null_data_source.tags_as_list_of_maps[4]: Refreshing state...
data.null_data_source.tags_as_list_of_maps[1]: Refreshing state...
data.null_data_source.tags_as_list_of_maps[2]: Refreshing state...
data.null_data_source.tags_as_list_of_maps[3]: Refreshing state...
data.null_data_source.tags_as_list_of_maps[0]: Refreshing state...
data.null_data_source.tags_as_list_of_maps[2]: Refreshing state...
data.null_data_source.tags_as_list_of_maps[1]: Refreshing state...
data.null_data_source.tags_as_list_of_maps[3]: Refreshing state...
data.null_data_source.tags_as_list_of_maps[4]: Refreshing state...

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

Outputs:

label1 = {
  attributes = fire-water-earth-air
  id = cloudposse-uat-build-winstonchurchroom-fire-water-earth-air
  name = winstonchurchroom
  namespace = cloudposse
  stage = build
}
label1_context = {
  attributes = [fire-water-earth-air]
  delimiter = [-]
  environment = [uat]
  name = [winstonchurchroom]
  namespace = [cloudposse]
  stage = [build]
  tags_keys = [City Environment Name Namespace Stage]
  tags_values = [Dublin Private cloudposse-uat-build-winstonchurchroom-fire-water-earth-air cloudposse build]
}
label1_tags = {
  City = Dublin
  Environment = Private
  Name = cloudposse-uat-build-winstonchurchroom-fire-water-earth-air
  Namespace = cloudposse
  Stage = build
}
label2 = {
  attributes = fire-water-earth-air
  id = cloudposse-uat-build-charlie-fire-water-earth-air
  name = charlie
  namespace = cloudposse
  stage = build
}
label2_context = {
  attributes = [fire-water-earth-air]
  delimiter = [-]
  environment = [uat]
  name = [charlie]
  namespace = [cloudposse]
  stage = [build]
  tags_keys = [City Environment Name Namespace Stage]
  tags_values = [London Public cloudposse-uat-build-charlie-fire-water-earth-air cloudposse build]
}
label2_tags = {
  City = London
  Environment = Public
  Name = cloudposse-uat-build-charlie-fire-water-earth-air
  Namespace = cloudposse
  Stage = build
}
label3 = {
  attributes = 
  id = release-starfish
  name = starfish
  namespace = 
  stage = release
}
label3_context = {
  attributes = []
  delimiter = [-]
  environment = []
  name = [starfish]
  namespace = []
  stage = [release]
  tags_keys = [Animal Eat Environment Name Namespace Stage]
  tags_values = [Rabbit Carrot  release-starfish  release]
}
label3_tags = {
  Animal = Rabbit
  Eat = Carrot
  Environment = 
  Name = release-starfish
  Namespace = 
  Stage = release
}
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 8 years ago
Minor?
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 8 years ago
What constitues a major?
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
haha, i know...
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
just i don't want to go to 1.0.0 yet
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 8 years ago
thats like... only got the same variables as the original
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
so, we say pre 1.0
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 8 years ago
okay
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago(edited)
so we are at 0.3.8 now, this should be 0.4.0
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
i am not yet sure what constitutes a 1.0.0 release - we don't yet have any 😃
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
probably a topic for another day... but some considerations are "stable interface"
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
so if we plan on adding a bunch more parameters, feels like the interface is not yet stable
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 8 years ago(edited)
You need a new "Definition of done"
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 8 years ago(edited)
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
thanks @Jamie Nelson (BitFlight)!
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago(edited)
@Jamie Nelson (BitFlight) I missed something maybe in that release... or at least let’s discuss
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
local.namespace, local.environment, local.stage
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
Seems to me that stage is more broad than environments
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
So it should come before environment
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
No?
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
@tamsky have any insights
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
Hrmm I guess I can see pros and cons both ways
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 8 years ago
What would be a real-life example of using both at the same time?
sarkis
sarkisover 8 years ago
@sarkis has joined the channel
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago(edited)
the challenge here is what we do with our 100 terraform modules that don't yet support environment
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
@tamsky any insights on ordering? namespace-stage-environment or namespace-environment-stage
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 8 years ago
In your terraform modules you can just leave it out
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 8 years ago
It can be either. But other companies may use both when stage is being referred to as the disposable type of stage. Like source, build, deploy. Or extract, transform, load. Or raw, resized, thumbnail.
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 8 years ago
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 8 years ago
@Jamie Nelson (BitFlight) @tamsky I understand the thinking about having stage and environment at the same time. But IMO it just complicates everything. You are saying that stage could refer to source, build, deploy, extract, transform, load. raw, resized, thumbnail. Those seem to be stages in an CI/CD pipeline or some other process of transforming data or building/deploying some artifacts. As I see it, they don’t relate to infrastructure environments that we deploy with Terraform. Are you saying that we need to deploy some TF resources with names like cp-prod-deploy-myapp, cp-prod-load-myapp? Sounds like parts of a pipeline, not a separate set of AWS resources
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 8 years ago
what would be a real example of using names like these in a real infrastructure having separate stages/environments like dev, prod?
Arkadiy
Arkadiyover 8 years ago
@Arkadiy has joined the channel
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 8 years ago
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 8 years ago
thanks @Jamie Nelson (BitFlight)
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 8 years ago
looks like all of that stage vs. environment stuff is used mostly for tagging, not for naming
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 8 years ago
which are diff things
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 8 years ago
ya
loren
lorenover 8 years ago
@loren has joined the channel
Ruslan
Ruslanover 8 years ago
@Ruslan has joined the channel
Ruslan
Ruslanover 8 years ago
Hi Everyone! First of all - big thanks for Terraform scripts on Github! It was invaluable source of knowledge and easy to use as is too.
Ruslan
Ruslanover 8 years ago
Come to talk about terraform-null-label and name sequence
Ruslan
Ruslanover 8 years ago

any insights on ordering? namespace-stage-environment or namespace-environment-stage
Ruslan
Ruslanover 8 years ago
In my opinion this should be configurable, because on the projects I am on right now we have namespace-app-stage.
Ruslan
Ruslanover 8 years ago
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
@Ruslan I have been considering this as well
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
To me, it’s most natural to move the environment after the stage
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
But allowing order to be overridden would be also a nice feature
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
@Jamie Nelson (BitFlight) ☝️
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 8 years ago
No problem
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 8 years ago
I’ll give it a pattern variable
Ruslan
Ruslanover 8 years ago
Personally I believe namespace-stage-app is proper way (because stage/env is the isolated space in which all the apps are working). But on the current project it is done as namespace-app-stage.
loren
lorenover 8 years ago
hey folks! does anyone know of tooling that helps create a terraform state file, based on a given terraform configuration, by importing existing resources?
loren
lorenover 8 years ago
we have a number of accounts with resources we can't recreate, but we're just getting started with terraform (switching from cloudformation). we've written terraform modules to manage everything, and it works great for new accounts, and now we're looking into how we can extend it to prior accounts...
loren
lorenover 8 years ago(edited)
terraform state list gives all the resource names, which seems to work with terraform import. however, it also outputs all the data source names (with no differentiation between resources and data sources), which don't need to be imported
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 8 years ago
@loren that is what terraforming does, http://terraforming.dtan4.net/
loren
lorenover 8 years ago
ahh thanks, i looked at that earlier, but it didn't seem like quite what i needed... i'll give it a try and see how it goes
loren
lorenover 8 years ago
i don't want to import all resources of a particular type, and i don't want the resources in the root module, which is what the examples look to be doing
loren
lorenover 8 years ago
but perhaps it has more options
loren
lorenover 8 years ago
seems not, unfortunately. any other tools?
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 8 years ago
You can use it to import everything, and then just manually edit the state file to only include the ones you want.
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 8 years ago
Its about all we have at the moment
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 8 years ago
@Ruslan @Erik Osterman (Cloud Posse) I've created a pull request that adds that feature you were after https://github.com/cloudposse/terraform-null-label/pull/36
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
I will take a look as soon as I get into the office
Ruslan
Ruslanover 8 years ago(edited)
Yes, it works, Ive tried it. <https://github.com/cloudposse/terraform-null-label/pull/36#issuecomment-408472191> However I am using label through terraform-aws-cicd and terraform-aws-codebuild` projects and need support in them for label_order.
Ruslan
Ruslanover 8 years ago
Should I add issue (or even better, PR) to these projects as well?
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
Yes we will accept PRs
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
Issue not needed
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
Regarding label module, I have an idea I want to test before I comment
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
But currently afk
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 8 years ago
For the label module, it looks now it would be better to just add a few parameters, p1, p2, p3, p4, p5, etc. and use them as we want. Instead of assigning a meaning to all of them and then decide on the order?
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
No
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
100% want meaning
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
I was just reflecting on this point
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
The thing is we need to standardize nomenclature
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
This is what I love about @Jamie Nelson (BitFlight) document for this
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
Even if I disagree with ‘environment’
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
However I have an idea based on what you say @Andriy Knysh (Cloud Posse)
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
Will whip up prototype to express how this should be working
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
I think it will satisfy everyone but might belong in a new module
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 8 years ago
Ok
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)over 8 years ago
Why naming is so hard :)
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 8 years ago
@Ruslan once the guys have reviewed the pull request and its good to add, we can start updating the other modules to be compatible with context.
Jamie Nelson (BitFlight)
Jamie Nelson (BitFlight)over 8 years ago
which will allow you to pass in a label modules context and use that for formatting.
johntellsall
johntellsallover 8 years ago
@johntellsall has joined the channel
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
I'm just about to step out the door for the evening, so will take a look tomorrow.
fernando
fernandoover 8 years ago
Sure thing, let me know what you think, and enjoy the rest of the evening!
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
Okay! I took a look. Looks good, almost exactly what we needed. Let's add test case for quoted numbers and booleans as well.
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago(edited)
@i5okie thanks for joining! Saw your comment on the issue here: https://github.com/cloudposse/terraform-aws-elastic-beanstalk-environment/issues/42
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
Let me know if I can be of assistance.
i5okie
i5okieover 8 years ago
yeah we had an older release of the module. i just copied the lifestyle block there
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago(edited)
Is it working now with the latest release?
i5okie
i5okieover 8 years ago
i didn't update to latest release (long story short, cant lol) but i copied the fix across. and its working now. thanks
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 8 years ago
ok, great!