File tree Expand file tree Collapse file tree 6 files changed +48
-12
lines changed
Expand file tree Collapse file tree 6 files changed +48
-12
lines changed Original file line number Diff line number Diff line change 11data "aws_partition" "current" {
2- count = var. create ? 1 : 0
2+ count = var. create && var . partition == " " ? 1 : 0
33}
44data "aws_caller_identity" "current" {
5- count = var. create ? 1 : 0
5+ count = var. create && var . account_id == " " ? 1 : 0
66}
77
88locals {
9- partition = try (data. aws_partition . current [0 ]. partition , " " )
10- account_id = try (data. aws_caller_identity . current [0 ]. account_id , " " )
9+ partition = try (data. aws_partition . current [0 ]. partition , var . partition )
10+ account_id = try (data. aws_caller_identity . current [0 ]. account_id , var . account_id )
1111}
1212
1313# ###############################################################################
Original file line number Diff line number Diff line change @@ -17,6 +17,18 @@ variable "region" {
1717 default = null
1818}
1919
20+ variable "partition" {
21+ description = " The AWS partition - pass through value to reduce number of GET requests from data sources"
22+ type = string
23+ default = " "
24+ }
25+
26+ variable "account_id" {
27+ description = " The AWS account ID - pass through value to reduce number of GET requests from data sources"
28+ type = string
29+ default = " "
30+ }
31+
2032# ###############################################################################
2133# User Data
2234# ###############################################################################
Original file line number Diff line number Diff line change @@ -4,15 +4,15 @@ data "aws_region" "current" {
44 region = var. region
55}
66data "aws_partition" "current" {
7- count = var. create ? 1 : 0
7+ count = var. create && var . partition == " " ? 1 : 0
88}
99data "aws_caller_identity" "current" {
10- count = var. create ? 1 : 0
10+ count = var. create && var . account_id == " " ? 1 : 0
1111}
1212
1313locals {
14- account_id = try (data. aws_caller_identity . current [0 ]. account_id , " " )
15- partition = try (data. aws_partition . current [0 ]. partition , " " )
14+ account_id = try (data. aws_caller_identity . current [0 ]. account_id , var . account_id )
15+ partition = try (data. aws_partition . current [0 ]. partition , var . partition )
1616 region = try (data. aws_region . current [0 ]. region , " " )
1717}
1818
Original file line number Diff line number Diff line change @@ -18,6 +18,18 @@ variable "region" {
1818 default = null
1919}
2020
21+ variable "partition" {
22+ description = " The AWS partition - pass through value to reduce number of GET requests from data sources"
23+ type = string
24+ default = " "
25+ }
26+
27+ variable "account_id" {
28+ description = " The AWS account ID - pass through value to reduce number of GET requests from data sources"
29+ type = string
30+ default = " "
31+ }
32+
2133# ###############################################################################
2234# IAM Role
2335# ###############################################################################
Original file line number Diff line number Diff line change 11data "aws_partition" "current" {
2- count = var. create ? 1 : 0
2+ count = var. create && var . partition == " " ? 1 : 0
33}
44data "aws_caller_identity" "current" {
5- count = var. create ? 1 : 0
5+ count = var. create && var . account_id == " " ? 1 : 0
66}
77
88locals {
9- partition = try (data. aws_partition . current [0 ]. partition , " " )
10- account_id = try (data. aws_caller_identity . current [0 ]. account_id , " " )
9+ partition = try (data. aws_partition . current [0 ]. partition , var . partition )
10+ account_id = try (data. aws_caller_identity . current [0 ]. account_id , var . account_id )
1111}
1212
1313# ###############################################################################
Original file line number Diff line number Diff line change @@ -17,6 +17,18 @@ variable "region" {
1717 default = null
1818}
1919
20+ variable "partition" {
21+ description = " The AWS partition - pass through value to reduce number of GET requests from data sources"
22+ type = string
23+ default = " "
24+ }
25+
26+ variable "account_id" {
27+ description = " The AWS account ID - pass through value to reduce number of GET requests from data sources"
28+ type = string
29+ default = " "
30+ }
31+
2032# ###############################################################################
2133# User Data
2234# ###############################################################################
You can’t perform that action at this time.
0 commit comments