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

Terraform add #106

Closed
wants to merge 40 commits into from
Closed

Terraform add #106

wants to merge 40 commits into from

Conversation

gohyk
Copy link
Collaborator

@gohyk gohyk commented Nov 7, 2021

Fixes #96

@gohyk gohyk marked this pull request as draft November 8, 2021 02:04
Copy link
Owner

@Zhiyuan-Amos Zhiyuan-Amos left a comment

Choose a reason for hiding this comment

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

Couple of questions:

  1. What does .terraform.lock.hcl do?
  2. Does main.tfplan need to be committed? Or is committing main.tf sufficient? Since .tfplan is generated from .tf, so the .tfplan can be generated by the build step.
  3. What's the difference between /test and /init directories?

Nice work btw!

Comment on lines 10 to 11
default = "southeastasia"
description = "Location of the resource group."
Copy link
Owner

Choose a reason for hiding this comment

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

Is description a required field? If not, is it necessary to specify the description?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is not a required field. Can be removed since it's straightforward

# Shortnames for regions can be found here:
# https://github.com/claranet/terraform-azurerm-regions/blob/master/REGIONS.md
variable "location" {
default = "southeastasia"
Copy link
Owner

Choose a reason for hiding this comment

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

Indentation looks off compared to rest of the files. Is there a way to auto-indent these files?

Comment on lines 1 to 4
variable "prefix" {
default = "test"
description = "Prefix of the resource group name that's combined with a random ID so name is unique in your Azure subscription."
}
Copy link
Owner

Choose a reason for hiding this comment

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

Can the prefix be dynamic? I am imagining that we name all the resources based on the branch's name. If so, do we:

  1. Still need the random id? That is, if there's a branch 1 year ago named foo which has been merged into master, and now I create a branch foo, will there be an issue?
  2. Do resources need to have a globally unique name (i.e. unique across all resources created by everyone using Azure). If not, can we simply name the Resource Group with the branch's name, and all the resources inside the Resource Group do not use prefixes? (i.e. imagine a folder containing files - the files across the different folders can have the same name).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

  1. Storage account names have to be unique within Azure mentioned here, hence the use for random-id

When naming your storage account, keep these rules in mind:
Storage account names must be between 3 and 24 characters in length and may contain numbers and lowercase letters only.
Your storage account name must be unique within Azure. No two storage accounts can have the same name.

  1. Sure, will update names of resource groups to be branch names


backend "azurerm" {
resource_group_name = "testResource"
storage_account_name = "teststorage70757"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

storage_account_name here is hardcoded

Comment on lines 10 to 11
default = "southeastasia"
description = "Location of the resource group."
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is not a required field. Can be removed since it's straightforward

Comment on lines 1 to 4
variable "prefix" {
default = "test"
description = "Prefix of the resource group name that's combined with a random ID so name is unique in your Azure subscription."
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

  1. Storage account names have to be unique within Azure mentioned here, hence the use for random-id

When naming your storage account, keep these rules in mind:
Storage account names must be between 3 and 24 characters in length and may contain numbers and lowercase letters only.
Your storage account name must be unique within Azure. No two storage accounts can have the same name.

  1. Sure, will update names of resource groups to be branch names


- name: Terraform Init
working-directory: ./terraform/terraform-remote-state
run: terraform init
Copy link
Owner

Choose a reason for hiding this comment

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

does the GitHub agent have terraform installed as a command-line tool? You might need

  • uses: hashicorp/setup-terraform@v1

https://github.com/hashicorp/setup-terraform#usage

@gohyk gohyk closed this Feb 26, 2022
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

Successfully merging this pull request may close these issues.

Terraform
2 participants