GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Cleaned up terraform and fixed backends by bmonkman · Pull Request #67 · commitdev/zero

Conversation

@bmonkman

@bmonkman bmonkman commented Nov 6, 2019

Copy link
Copy Markdown
Contributor

Refactored all templators to use a config holder so we can extend them in the future if we need more data.
Modified names of things in TF to reduce conflicts within the same AWS account.
Fixed S3 backend. Wasn't working at all because it can't live in a module, and can't contain string interpolation.

Still more to do to make everything fully repeatable, will probably do it in another ticket.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bmonkman
Cleaned up terraform and fixed backends
9ee7335
Refactored all templators to use a config holder so we can extend them in the future if we need more data.
Modified names of things in TF to reduce conflicts within the same AWS account.
Fixed S3 backend. Wasn't working at all because it can't live in a module, and can't contain string interpolation.

Still more to do to make everything fully repeatable, will probably do it in another ticket.
@bmonkman
bmonkman requested a review from ShahNewazKhan November 6, 2019 02:02
bmonkman
bmonkman commented Nov 6, 2019
View reviewed changes
Comment thread templates/kubernetes/terraform/modules/vpc/main.tf Resolved

Uh oh!

There was an error while loading. Please reload this page.

bmonkman
bmonkman commented Nov 6, 2019
View reviewed changes
Comment thread templates/kubernetes/terraform/global/remote-state/main.tf
@@ -0,0 +1,24 @@
provider "aws" {

@bmonkman bmonkman Nov 6, 2019

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To create the actual backend bucket and dynamo db. This will need to be run in a separate tf apply before the tf init of the rest of the infra. This will be an interesting piece to automate..

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@ShahNewazKhan ShahNewazKhan Nov 6, 2019

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can move it to a seperate .tf file and use terraform apply target to apply specifically only that portion

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@bmonkman bmonkman Nov 7, 2019

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That wouldn't be a great workflow going forward though, because you wouldn't be able to run plan/apply in the main dir.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@ShahNewazKhan ShahNewazKhan Nov 7, 2019

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about using the depends on clause?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@bmonkman bmonkman Nov 7, 2019

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They have to be run separately, because one creates the global state and should never be run again, and the other one uses the global state.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@ShahNewazKhan ShahNewazKhan Nov 7, 2019

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, does it make sense to enclose the backend init in a shell script then or boto3?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@ShahNewazKhan ShahNewazKhan Nov 7, 2019

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That way we can both spin up and tear down the backend init based on tf apply and tf destroy

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@bmonkman bmonkman Nov 7, 2019

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gonna stick with this for now and we'll see how complex the process gets to see if it warrants adding helpers..

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
bmonkman
bmonkman commented Nov 6, 2019
View reviewed changes
Comment thread templates/kubernetes/terraform/environments/development/main.tf Resolved

Uh oh!

There was an error while loading. Please reload this page.

ShahNewazKhan
ShahNewazKhan approved these changes Nov 7, 2019
View reviewed changes

@ShahNewazKhan ShahNewazKhan left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bmonkman
bmonkman merged commit f2e07ef into master Nov 7, 2019
@bmonkman
bmonkman deleted the cleanup-terraform-and-fix-backends branch November 7, 2019 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer
@ShahNewazKhan ShahNewazKhan ShahNewazKhan approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@bmonkman @ShahNewazKhan
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.