File tree Expand file tree Collapse file tree 5 files changed +57
-12
lines changed Expand file tree Collapse file tree 5 files changed +57
-12
lines changed Original file line number Diff line number Diff line change @@ -3,17 +3,17 @@ name: auto-release
33on :
44 push :
55 branches :
6- - master
6+ - master
77
88jobs :
99 semver :
1010 runs-on : ubuntu-latest
1111 steps :
12- # Drafts your next Release notes as Pull Requests are merged into "master"
13- - uses : release-drafter/release-drafter@v5
14- with :
15- publish : true
16- prerelease : false
17- config-name : auto-release.yml
18- env :
19- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
12+ # Drafts your next Release notes as Pull Requests are merged into "master"
13+ - uses : release-drafter/release-drafter@v5
14+ with :
15+ publish : true
16+ prerelease : false
17+ config-name : auto-release.yml
18+ env :
19+ GITHUB_TOKEN : ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
File renamed without changes.
Original file line number Diff line number Diff line change @@ -33,6 +33,41 @@ module "subnets" {
3333 context = module. this . context
3434}
3535
36+ module "instance_profile_label" {
37+ source = " git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.19.2"
38+
39+ attributes = distinct (compact (concat (module. this . attributes , [" profile" ])))
40+
41+ context = module. this . context
42+ }
43+
44+ data "aws_iam_policy_document" "test" {
45+ statement {
46+ effect = " Allow"
47+
48+ actions = [
49+ " sts:AssumeRole"
50+ ]
51+
52+ principals {
53+ type = " Service"
54+ identifiers = [" ec2.amazonaws.com" ]
55+ }
56+ }
57+ }
58+
59+ resource "aws_iam_role" "test" {
60+ name = module. instance_profile_label . id
61+ assume_role_policy = data. aws_iam_policy_document . test . json
62+ tags = module. instance_profile_label . tags
63+ }
64+
65+ # https://github.com/hashicorp/terraform-guides/tree/master/infrastructure-as-code/terraform-0.13-examples/module-depends-on
66+ resource "aws_iam_instance_profile" "test" {
67+ name = module. instance_profile_label . id
68+ role = aws_iam_role. test . name
69+ }
70+
3671module "ec2_instance" {
3772 source = " ../../"
3873
@@ -45,6 +80,7 @@ module "ec2_instance" {
4580 instance_type = var. instance_type
4681 allowed_ports = var. allowed_ports
4782 allowed_ports_udp = var. allowed_ports_udp
83+ instance_profile = aws_iam_instance_profile. test . name
4884
4985 context = module. this . context
5086}
Original file line number Diff line number Diff line change @@ -70,9 +70,18 @@ data "aws_ami" "info" {
7070 owners = [local . ami_owner ]
7171}
7272
73- data "aws_iam_instance_profile" "given" {
73+ # https://github.com/hashicorp/terraform-guides/tree/master/infrastructure-as-code/terraform-0.13-examples/module-depends-on
74+ resource "null_resource" "instance_profile_dependency" {
7475 count = module. this . enabled && length (var. instance_profile ) > 0 ? 1 : 0
75- name = var. instance_profile
76+ triggers = {
77+ dependency_id = var.instance_profile
78+ }
79+ }
80+
81+ data "aws_iam_instance_profile" "given" {
82+ count = module. this . enabled && length (var. instance_profile ) > 0 ? 1 : 0
83+ name = var. instance_profile
84+ depends_on = [null_resource. instance_profile_dependency ]
7685}
7786
7887resource "aws_iam_instance_profile" "default" {
Original file line number Diff line number Diff line change @@ -64,5 +64,5 @@ func TestExamplesComplete(t *testing.T) {
6464 // Run `terraform output` to get the value of an output variable
6565 role := terraform .Output (t , terraformOptions , "role" )
6666 // Verify we're getting back the outputs we expect
67- assert .Equal (t , "eg-test-ec2-instance-" + randId , role )
67+ assert .Equal (t , "eg-test-ec2-instance-" + randId + "-profile" , role )
6868}
You can’t perform that action at this time.
0 commit comments