Skip to content

Commit

Permalink
aws: upgrade to terraform 1.1.X and aws 4.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
melzer-b1 authored and yeoldegrove committed Feb 28, 2022
1 parent ccaf0b9 commit 2a5def9
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 23 deletions.
40 changes: 40 additions & 0 deletions aws/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion aws/create_remote_state/dynamodb.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# create a dynamodb table for locking the state file
resource "aws_dynamodb_table" "dynamodb-terraform-state-lock" {
name = "${var.dynamodb_name}"
name = var.dynamodb_name
hash_key = "LockID"
read_capacity = 20
write_capacity = 20
Expand Down
4 changes: 2 additions & 2 deletions aws/create_remote_state/main.tf
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
provider "aws" {
region = "${var.aws_region}"
region = var.aws_region
}

resource "aws_s3_bucket" "terraform_state" {
bucket = "${var.bucket_name}"
bucket = var.bucket_name

versioning {
enabled = true
Expand Down
10 changes: 0 additions & 10 deletions aws/infrastructure.tf
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
# Configure the AWS Provider
provider "aws" {
version = "~> 3.11.0"
region = var.aws_region
}

terraform {
required_version = ">= 0.13"
}

data "aws_vpc" "current-vpc" {
count = var.vpc_id != "" ? 1 : 0
id = var.vpc_id
Expand Down
2 changes: 1 addition & 1 deletion aws/modules/drbd_node/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ resource "aws_route" "drbd-cluster-vip" {
count = var.drbd_count > 0 ? 1 : 0
route_table_id = var.route_table_id
destination_cidr_block = "${var.common_variables["drbd"]["cluster_vip"]}/32"
instance_id = aws_instance.drbd.0.id
network_interface_id = aws_instance.drbd.0.primary_network_interface_id
}

module "sap_cluster_policies" {
Expand Down
6 changes: 3 additions & 3 deletions aws/modules/hana_node/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ resource "aws_route" "hana-cluster-vip" {
count = local.create_ha_infra
route_table_id = var.route_table_id
destination_cidr_block = "${var.common_variables["hana"]["cluster_vip"]}/32"
instance_id = aws_instance.hana.0.id
network_interface_id = aws_instance.hana.0.primary_network_interface_id
}

resource "aws_route" "hana-cluster-vip-secondary" {
count = local.create_ha_infra == 1 && var.common_variables["hana"]["cluster_vip_secondary"] != "" ? 1 : 0
route_table_id = var.route_table_id
destination_cidr_block = "${var.common_variables["hana"]["cluster_vip_secondary"]}/32"
instance_id = aws_instance.hana.1.id
network_interface_id = aws_instance.hana.1.primary_network_interface_id
}

module "sap_cluster_policies" {
Expand Down Expand Up @@ -66,8 +66,8 @@ resource "aws_instance" "hana" {
private_ip = element(var.host_ips, count.index)
vpc_security_group_ids = [var.security_group_id]
availability_zone = element(var.availability_zones, count.index)
source_dest_check = false
iam_instance_profile = module.sap_cluster_policies.cluster_profile_name[0]
source_dest_check = false

root_block_device {
volume_type = "gp2"
Expand Down
8 changes: 4 additions & 4 deletions aws/modules/netweaver_node/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,30 +28,30 @@ resource "aws_route" "nw-ascs-route" {
count = local.vm_count > 0 ? 1 : 0
route_table_id = var.route_table_id
destination_cidr_block = "${element(var.virtual_host_ips, 0)}/32"
instance_id = aws_instance.netweaver.0.id
network_interface_id = aws_instance.netweaver.0.primary_network_interface_id
}

resource "aws_route" "nw-ers-route" {
count = local.create_ha_infra
route_table_id = var.route_table_id
destination_cidr_block = "${element(var.virtual_host_ips, 1)}/32"
instance_id = aws_instance.netweaver.1.id
network_interface_id = aws_instance.netweaver.1.primary_network_interface_id
}

# deploy if PAS on same machine as ASCS
resource "aws_route" "nw-pas-route" {
count = local.vm_count > 0 && var.app_server_count == 0 ? 1 : 0
route_table_id = var.route_table_id
destination_cidr_block = "${element(var.virtual_host_ips, local.app_start_index)}/32"
instance_id = aws_instance.netweaver.0.id
network_interface_id = aws_instance.netweaver.0.primary_network_interface_id
}

# deploy if PAS and AAS on separate hosts
resource "aws_route" "nw-app-route" {
count = var.app_server_count
route_table_id = var.route_table_id
destination_cidr_block = "${element(var.virtual_host_ips, local.app_start_index + count.index)}/32"
instance_id = aws_instance.netweaver[local.app_start_index + count.index].id
network_interface_id = aws_instance.netweaver[local.app_start_index + count.index].primary_network_interface_id
}

resource "aws_efs_mount_target" "netweaver-efs-mount-target" {
Expand Down
4 changes: 2 additions & 2 deletions aws/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ variable "hana_scale_out_shared_storage_type" {
}

variable "hana_scale_out_addhosts" {
type = map
type = map(any)
default = {}
description = <<EOF
Additional hosts to pass to HANA scale-out installation
Expand Down Expand Up @@ -855,7 +855,7 @@ variable "netweaver_sapexe_folder" {

variable "netweaver_additional_dvds" {
description = "Software folder with additional SAP software needed to install netweaver (NW export folder and HANA HDB client for example), path relative from the `netweaver_inst_media` mounted point"
type = list
type = list(any)
default = []
}

Expand Down
19 changes: 19 additions & 0 deletions aws/version.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
terraform {
required_version = ">= 1.1.0"
required_providers {
# Configure the Azure Provider
aws = {
source = "hashicorp/aws"
version = "~> 4.0.0"
}
null = {
source = "hashicorp/null"
version = "~> 3.1.0"
}
}
}

# Configure the AWS Provider
provider "aws" {
region = var.aws_region
}

0 comments on commit 2a5def9

Please sign in to comment.