Skip to content

Commit

Permalink
Merge pull request aws-ia#1 from aws-samples/feature/fmt
Browse files Browse the repository at this point in the history
Terraform Formatting
  • Loading branch information
niallthomson authored Apr 30, 2022
2 parents 5dde24f + 46ba5f7 commit 15bb3b8
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 30 deletions.
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ To send us a pull request, please:
1. Fork the repository.
2. Modify the source; please focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change.
3. Ensure local tests pass.
4. Ensure code files are formatted using language provided tools such as `terraform fmt`.
4. Commit to your fork using clear commit messages.
5. Send us a pull request, answering any default questions in the pull request interface.
6. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.
Expand Down
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
.PHONY: serve
serve:
cd site; hugo serve
cd site; hugo serve

.PHONY: tf-fmt
tf-fmt:
cd ./terraform && terraform fmt --recursive
2 changes: 1 addition & 1 deletion terraform/cluster-only/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module "cluster" {
source = "../modules/cluster"
source = "../modules/cluster"

id = var.id
}
16 changes: 8 additions & 8 deletions terraform/full/main.tf
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
data "aws_region" "current" {}

module "cluster" {
source = "../modules/cluster"
source = "../modules/cluster"

id = var.id

map_roles = [{
rolearn = module.ide.cloud9_iam_role
rolearn = module.ide.cloud9_iam_role
username = "cloud9"
groups = ["system:masters"]
groups = ["system:masters"]
}]
}

Expand All @@ -31,11 +31,11 @@ resource "aws_s3_object" "bootstrap_archive" {
}

module "ide" {
source = "../modules/ide"
source = "../modules/ide"

environment_name = module.cluster.eks_cluster_id
subnet_id = module.cluster.public_subnet_ids[0]
additional_cloud9_policies = [{
environment_name = module.cluster.eks_cluster_id
subnet_id = module.cluster.public_subnet_ids[0]
additional_cloud9_policies = [{
Version = "2012-10-17",
Statement = [
{
Expand All @@ -51,7 +51,7 @@ module "ide" {
]
}
]
},{
}, {
Version = "2012-10-17",
Statement = [
{
Expand Down
2 changes: 1 addition & 1 deletion terraform/modules/cluster/addons.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ module "eks-blueprints-kubernetes-addons" {

enable_aws_load_balancer_controller = true
aws_load_balancer_controller_helm_config = {
version = var.aws_load_balancer_controller_version
version = var.aws_load_balancer_controller_version
}
}
2 changes: 1 addition & 1 deletion terraform/modules/cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ provider "helm" {
locals {
tenant = "eksw"
environment = "env"
zone = var.id
zone = var.id

cluster_version = var.cluster_version

Expand Down
4 changes: 2 additions & 2 deletions terraform/modules/cluster/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ output "configure_kubectl" {

output "private_subnet_ids" {
description = "Private Subnet Ids"
value = module.aws_vpc.private_subnets
value = module.aws_vpc.private_subnets
}

output "public_subnet_ids" {
description = "Public Subnet Ids"
value = module.aws_vpc.public_subnets
value = module.aws_vpc.public_subnets
}
2 changes: 1 addition & 1 deletion terraform/modules/cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ variable "map_roles" {
username = string
groups = list(string)
}))
default = []
default = []
}
14 changes: 7 additions & 7 deletions terraform/modules/ide/cloud9.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
resource "aws_cloud9_environment_ec2" "c9_workspace" {
instance_type = var.instance_type
name = var.environment_name
instance_type = var.instance_type
name = var.environment_name
automatic_stop_time_minutes = 90

tags = {
Cloud9Bootstrap = "Active"
}
Expand Down Expand Up @@ -61,7 +61,7 @@ resource "aws_iam_policy" "cloud9_additional_policy" {

resource "aws_iam_role_policy_attachment" "cloud9_additional_policy" {
count = length(var.additional_cloud9_policies)

role = aws_iam_role.cloud9_role.name
policy_arn = aws_iam_policy.cloud9_additional_policy[count.index].arn
}
Expand All @@ -76,9 +76,9 @@ resource "aws_lambda_invocation" "cloud9_instance_profile" {
function_name = module.cloud9_bootstrap_lambda.lambda_function_name

input = jsonencode({
instance_id = data.aws_instance.cloud9_instance.id
instance_profile_arn = aws_iam_instance_profile.cloud9_ssm_instance_profile.arn
instance_id = data.aws_instance.cloud9_instance.id
instance_profile_arn = aws_iam_instance_profile.cloud9_ssm_instance_profile.arn
instance_profile_name = aws_iam_instance_profile.cloud9_ssm_instance_profile.name
disk_size = var.disk_size
disk_size = var.disk_size
})
}
16 changes: 8 additions & 8 deletions terraform/modules/ide/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@ variable "subnet_id" {
}

variable "environment_name" {
type = string
default = "test"
type = string
default = "test"
}

variable "disk_size" {
type = number
default = 60
type = number
default = 60
}

variable "bootstrap_script" {
type = string
default = "echo 'No extension bootstrap'"
type = string
default = "echo 'No extension bootstrap'"
}

variable "additional_cloud9_policies" {
type = list
default = []
type = list(any)
default = []
}

variable "cloud9_user_arns" {
Expand Down

0 comments on commit 15bb3b8

Please sign in to comment.