-
Notifications
You must be signed in to change notification settings - Fork 497
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #372 from acc-jon/master
Address #365 by properly handling submodule path
- Loading branch information
Showing
7 changed files
with
113 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
pkg/iac-providers/terraform/v12/testdata/deep-modules/modules/m1/main.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
variable "m1projectid" { | ||
type = string | ||
default = "asdfasdf" | ||
} | ||
|
||
module "m2" { | ||
source = "../m2" | ||
m2versionyear = "2012" | ||
m2versionmonth = "10" | ||
m2versionday = "17" | ||
m2bucketname = module.m3.fullbucketname | ||
} | ||
module "m3" { | ||
source = "../m3" | ||
m3bucketname = var.m1projectid | ||
m3environment = "dev" | ||
} | ||
|
||
|
||
resource "aws_s3_bucket" "bucket" { | ||
bucket = module.m3.fullbucketname | ||
policy = module.m2.fullbucketpolicy | ||
} |
36 changes: 36 additions & 0 deletions
36
pkg/iac-providers/terraform/v12/testdata/deep-modules/modules/m2/main.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
variable "m2versionyear" { | ||
type = string | ||
} | ||
variable "m2versionmonth" { | ||
type = string | ||
} | ||
variable "m2versionday" { | ||
type = string | ||
} | ||
variable "m2bucketname" { | ||
type = string | ||
} | ||
data "aws_iam_policy_document" "readbuckets" { | ||
source_json = <<EOF | ||
{ | ||
"Version":"${var.m2versionyear}-${var.m2versionmonth}-${var.m2versionday}", | ||
"Statement":[ | ||
{ | ||
"Sid": "PublicRead", | ||
"Effect": "Allow", | ||
"Principal": "*", | ||
"Action": ["s3:GetObject"], | ||
"Resource": ["arn:aws:s3:::${var.m2bucketname}/*"] | ||
} | ||
] | ||
} | ||
EOF | ||
} | ||
|
||
output "fullbucketpolicy" { | ||
value = data.aws_iam_policy_document.readbuckets.json | ||
} | ||
output "BucketARN" { | ||
value = var.m2bucketname | ||
} | ||
|
17 changes: 17 additions & 0 deletions
17
pkg/iac-providers/terraform/v12/testdata/deep-modules/modules/m3/main.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
variable "m3bucketname" { | ||
type = string | ||
} | ||
variable "m3environment" { | ||
type = string | ||
} | ||
|
||
output "fullbucketname" { | ||
value = "${var.m3bucketname}-${var.m3environment}" | ||
} | ||
output "sourcebucketname" { | ||
value = var.m3bucketname | ||
} | ||
output "sourceenvironment" { | ||
value = var.m3environment | ||
} | ||
|
14 changes: 14 additions & 0 deletions
14
pkg/iac-providers/terraform/v12/testdata/deep-modules/template.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
terraform { | ||
required_version = ">= 0.12.0" | ||
} | ||
|
||
provider "aws" { | ||
version = "2.58.0" | ||
region = "us-east-1" | ||
} | ||
|
||
|
||
module "m1" { | ||
source = "./modules/m1" | ||
m1projectid = "tf-test-project" | ||
} |
15 changes: 15 additions & 0 deletions
15
pkg/iac-providers/terraform/v12/testdata/tfjson/deep-modules.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"aws_s3_bucket": [ | ||
{ | ||
"id": "aws_s3_bucket.bucket", | ||
"name": "bucket", | ||
"source": "modules/m1/main.tf", | ||
"line": 20, | ||
"type": "aws_s3_bucket", | ||
"config": { | ||
"bucket": "${module.m3.fullbucketname}", | ||
"policy": "${module.m2.fullbucketpolicy}" | ||
} | ||
} | ||
] | ||
} |