Skip to content

Commit 0586277

Browse files
authored
Support AWS Provider V5 (#126)
* Support AWS Provider V5 * Support AWS Provider V5 * remove deprecated API hashicorp/terraform-provider-aws#17465
1 parent dac7df9 commit 0586277

12 files changed

+82
-105
lines changed

.github/renovate.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
{
22
"extends": [
33
"config:base",
4-
":preserveSemverRanges"
4+
":preserveSemverRanges",
5+
":rebaseStalePrs"
56
],
6-
"baseBranches": ["main", "master", "/^release\\/v\\d{1,2}$/"],
7+
"baseBranches": ["main"],
78
"labels": ["auto-update"],
89
"dependencyDashboardAutoclose": true,
910
"enabledManagers": ["terraform"],
1011
"terraform": {
11-
"ignorePaths": ["**/context.tf", "examples/**"]
12+
"ignorePaths": ["**/context.tf"]
1213
}
1314
}

.github/workflows/release-branch.yml

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
- 'docs/**'
1111
- 'examples/**'
1212
- 'test/**'
13+
- 'README.*'
1314

1415
permissions:
1516
contents: write

.github/workflows/release-published.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ permissions:
1111

1212
jobs:
1313
terraform-module:
14-
uses: cloudposse/github-actions-workflows-terraform-module/.github/workflows/release.yml@main
14+
uses: cloudposse/github-actions-workflows-terraform-module/.github/workflows/release-published.yml@main

README.md

+16-55
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,6 @@ Terraform module to create AWS CodeBuild project for AWS CodePipeline.
3333
---
3434

3535
This project is part of our comprehensive ["SweetOps"](https://cpco.io/sweetops) approach towards DevOps.
36-
[<img align="right" title="Share via Email" src="https://docs.cloudposse.com/images/ionicons/ios-email-outline-2.0.1-16x16-999999.svg"/>][share_email]
37-
[<img align="right" title="Share on Google+" src="https://docs.cloudposse.com/images/ionicons/social-googleplus-outline-2.0.1-16x16-999999.svg" />][share_googleplus]
38-
[<img align="right" title="Share on Facebook" src="https://docs.cloudposse.com/images/ionicons/social-facebook-outline-2.0.1-16x16-999999.svg" />][share_facebook]
39-
[<img align="right" title="Share on Reddit" src="https://docs.cloudposse.com/images/ionicons/social-reddit-outline-2.0.1-16x16-999999.svg" />][share_reddit]
40-
[<img align="right" title="Share on LinkedIn" src="https://docs.cloudposse.com/images/ionicons/social-linkedin-outline-2.0.1-16x16-999999.svg" />][share_linkedin]
41-
[<img align="right" title="Share on Twitter" src="https://docs.cloudposse.com/images/ionicons/social-twitter-outline-2.0.1-16x16-999999.svg" />][share_twitter]
4236

4337

4438
[![Terraform Open Source Modules](https://docs.cloudposse.com/images/terraform-open-source-modules.svg)][terraform_modules]
@@ -88,10 +82,6 @@ We highly recommend that in your code you pin the version to the exact version y
8882
using so that your infrastructure remains stable, and update versions in a
8983
systematic way so that they do not catch you by surprise.
9084

91-
Also, because of a bug in the Terraform registry ([hashicorp/terraform#21417](https://github.com/hashicorp/terraform/issues/21417)),
92-
the registry shows many of our inputs as required when in fact they are optional.
93-
The table below correctly indicates which inputs are required.
94-
9585

9686
Include this module in your existing terraform code:
9787

@@ -163,15 +153,15 @@ Available targets:
163153

164154
| Name | Version |
165155
|------|---------|
166-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.0 |
167-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 2.0 |
156+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3 |
157+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.0 |
168158
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 2.1 |
169159

170160
## Providers
171161

172162
| Name | Version |
173163
|------|---------|
174-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 2.0 |
164+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.0 |
175165
| <a name="provider_random"></a> [random](#provider\_random) | >= 2.1 |
176166

177167
## Modules
@@ -295,8 +285,6 @@ Available targets:
295285

296286
Like this project? Please give it a ★ on [our GitHub](https://github.com/cloudposse/terraform-aws-codebuild)! (it helps us **a lot**)
297287

298-
Are you using this project or any of our other projects? Consider [leaving a testimonial][testimonial]. =)
299-
300288

301289

302290
## Related Projects
@@ -339,10 +327,6 @@ We deliver 10x the value for a fraction of the cost of a full-time engineer. Our
339327

340328
Join our [Open Source Community][slack] on Slack. It's **FREE** for everyone! Our "SweetOps" community is where you get to talk with others who share a similar vision for how to rollout and manage infrastructure. This is the best place to talk shop, ask questions, solicit feedback, and work together as a community to build totally *sweet* infrastructure.
341329

342-
## Discourse Forums
343-
344-
Participate in our [Discourse Forums][discourse]. Here you'll find answers to commonly asked questions. Most questions will be related to the enormous number of projects we support on our GitHub. Come here to collaborate on answers, find solutions, and get ideas about the products and services we value. It only takes a minute to get started! Just sign in with SSO using your GitHub account.
345-
346330
## Newsletter
347331

348332
Sign up for [our newsletter][newsletter] that covers everything on our technology radar. Receive updates on what we're up to on GitHub as well as awesome new projects we discover.
@@ -353,7 +337,18 @@ Sign up for [our newsletter][newsletter] that covers everything on our technolog
353337

354338
[![zoom](https://img.cloudposse.com/fit-in/200x200/https://cloudposse.com/wp-content/uploads/2019/08/Powered-by-Zoom.png")][office_hours]
355339

356-
## Contributing
340+
## ✨ Contributing
341+
342+
343+
344+
This project is under active development, and we encourage contributions from our community.
345+
Many thanks to our outstanding contributors:
346+
347+
<a href="https://github.com/cloudposse/terraform-aws-codebuild/graphs/contributors">
348+
<img src="https://contrib.rocks/image?repo=cloudposse/terraform-aws-codebuild&max=24" />
349+
</a>
350+
351+
357352

358353
### Bug Reports & Feature Requests
359354

@@ -427,33 +422,7 @@ We're a [DevOps Professional Services][hire] company based in Los Angeles, CA. W
427422

428423
We offer [paid support][commercial_support] on all of our projects.
429424

430-
Check out [our other projects][github], [follow us on twitter][twitter], [apply for a job][jobs], or [hire us][hire] to help with your cloud strategy and implementation.
431-
432-
433-
434-
### Contributors
435-
436-
<!-- markdownlint-disable -->
437-
| [![Erik Osterman][osterman_avatar]][osterman_homepage]<br/>[Erik Osterman][osterman_homepage] | [![Igor Rodionov][goruha_avatar]][goruha_homepage]<br/>[Igor Rodionov][goruha_homepage] | [![Andriy Knysh][aknysh_avatar]][aknysh_homepage]<br/>[Andriy Knysh][aknysh_homepage] | [![Jamie Nelson][Jamie-BitFlight_avatar]][Jamie-BitFlight_homepage]<br/>[Jamie Nelson][Jamie-BitFlight_homepage] | [![Sarkis Varozian][sarkis_avatar]][sarkis_homepage]<br/>[Sarkis Varozian][sarkis_homepage] | [![Bircan Bilici][brcnblc_avatar]][brcnblc_homepage]<br/>[Bircan Bilici][brcnblc_homepage] | [![RB][nitrocode_avatar]][nitrocode_homepage]<br/>[RB][nitrocode_homepage] |
438-
|---|---|---|---|---|---|---|
439-
<!-- markdownlint-restore -->
440-
441-
[osterman_homepage]: https://github.com/osterman
442-
[osterman_avatar]: https://img.cloudposse.com/150x150/https://github.com/osterman.png
443-
[goruha_homepage]: https://github.com/goruha
444-
[goruha_avatar]: https://img.cloudposse.com/150x150/https://github.com/goruha.png
445-
[aknysh_homepage]: https://github.com/aknysh
446-
[aknysh_avatar]: https://img.cloudposse.com/150x150/https://github.com/aknysh.png
447-
[Jamie-BitFlight_homepage]: https://github.com/Jamie-BitFlight
448-
[Jamie-BitFlight_avatar]: https://img.cloudposse.com/150x150/https://github.com/Jamie-BitFlight.png
449-
[sarkis_homepage]: https://github.com/sarkis
450-
[sarkis_avatar]: https://img.cloudposse.com/150x150/https://github.com/sarkis.png
451-
[brcnblc_homepage]: https://github.com/brcnblc
452-
[brcnblc_avatar]: https://img.cloudposse.com/150x150/https://github.com/brcnblc.png
453-
[nitrocode_homepage]: https://github.com/nitrocode
454-
[nitrocode_avatar]: https://img.cloudposse.com/150x150/https://github.com/nitrocode.png
455-
456-
[![README Footer][readme_footer_img]][readme_footer_link]
425+
Check out [our other projects][github], [follow us on twitter][twitter], [apply for a job][jobs], or [hire us][hire] to help with your cloud strategy and implementation.[![README Footer][readme_footer_img]][readme_footer_link]
457426
[![Beacon][beacon]][website]
458427
<!-- markdownlint-disable -->
459428
[logo]: https://cloudposse.com/logo-300x69.svg
@@ -463,12 +432,10 @@ Check out [our other projects][github], [follow us on twitter][twitter], [apply
463432
[jobs]: https://cpco.io/jobs?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-codebuild&utm_content=jobs
464433
[hire]: https://cpco.io/hire?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-codebuild&utm_content=hire
465434
[slack]: https://cpco.io/slack?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-codebuild&utm_content=slack
466-
[linkedin]: https://cpco.io/linkedin?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-codebuild&utm_content=linkedin
467435
[twitter]: https://cpco.io/twitter?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-codebuild&utm_content=twitter
468436
[testimonial]: https://cpco.io/leave-testimonial?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-codebuild&utm_content=testimonial
469437
[office_hours]: https://cloudposse.com/office-hours?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-codebuild&utm_content=office_hours
470438
[newsletter]: https://cpco.io/newsletter?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-codebuild&utm_content=newsletter
471-
[discourse]: https://ask.sweetops.com/?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-codebuild&utm_content=discourse
472439
[email]: https://cpco.io/email?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-codebuild&utm_content=email
473440
[commercial_support]: https://cpco.io/commercial-support?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-codebuild&utm_content=commercial_support
474441
[we_love_open_source]: https://cpco.io/we-love-open-source?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-codebuild&utm_content=we_love_open_source
@@ -479,11 +446,5 @@ Check out [our other projects][github], [follow us on twitter][twitter], [apply
479446
[readme_footer_link]: https://cloudposse.com/readme/footer/link?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-codebuild&utm_content=readme_footer_link
480447
[readme_commercial_support_img]: https://cloudposse.com/readme/commercial-support/img
481448
[readme_commercial_support_link]: https://cloudposse.com/readme/commercial-support/link?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-codebuild&utm_content=readme_commercial_support_link
482-
[share_twitter]: https://twitter.com/intent/tweet/?text=terraform-aws-codebuild&url=https://github.com/cloudposse/terraform-aws-codebuild
483-
[share_linkedin]: https://www.linkedin.com/shareArticle?mini=true&title=terraform-aws-codebuild&url=https://github.com/cloudposse/terraform-aws-codebuild
484-
[share_reddit]: https://reddit.com/submit/?url=https://github.com/cloudposse/terraform-aws-codebuild
485-
[share_facebook]: https://facebook.com/sharer/sharer.php?u=https://github.com/cloudposse/terraform-aws-codebuild
486-
[share_googleplus]: https://plus.google.com/share?url=https://github.com/cloudposse/terraform-aws-codebuild
487-
[share_email]: mailto:?subject=terraform-aws-codebuild&body=https://github.com/cloudposse/terraform-aws-codebuild
488449
[beacon]: https://ga-beacon.cloudposse.com/UA-76589703-4/cloudposse/terraform-aws-codebuild?pixel&cs=github&cm=readme&an=terraform-aws-codebuild
489450
<!-- markdownlint-restore -->

docs/terraform.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33

44
| Name | Version |
55
|------|---------|
6-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.0 |
7-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 2.0 |
6+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3 |
7+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.0 |
88
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 2.1 |
99

1010
## Providers
1111

1212
| Name | Version |
1313
|------|---------|
14-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 2.0 |
14+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.0 |
1515
| <a name="provider_random"></a> [random](#provider\_random) | >= 2.1 |
1616

1717
## Modules

examples/bitbucket/versions.tf

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
terraform {
2+
required_version = ">= 1.3"
3+
4+
required_providers {
5+
aws = {
6+
source = "hashicorp/aws"
7+
version = ">= 5.0"
8+
}
9+
}
10+
}

examples/complete/versions.tf

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
terraform {
2-
required_version = ">= 0.13.0"
2+
required_version = ">= 1.3"
33

44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 2.0"
7+
version = ">= 5.0"
88
}
99
random = {
1010
source = "hashicorp/random"

examples/vpc/main.tf

+10-8
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,23 @@ provider "aws" {
33
}
44

55
module "vpc" {
6-
source = "cloudposse/vpc/aws"
7-
version = "0.21.1"
8-
cidr_block = var.vpc_cidr_block
6+
source = "cloudposse/vpc/aws"
7+
version = "2.1.1"
8+
9+
ipv4_primary_cidr_block = var.vpc_cidr_block
910

1011
context = module.this.context
1112
}
1213

1314
module "subnets" {
14-
source = "cloudposse/dynamic-subnets/aws"
15-
version = "0.38.0"
15+
source = "cloudposse/dynamic-subnets/aws"
16+
version = "2.4.1"
17+
1618
availability_zones = var.availability_zones
1719
vpc_id = module.vpc.vpc_id
18-
igw_id = module.vpc.igw_id
19-
cidr_block = module.vpc.vpc_cidr_block
20-
nat_gateway_enabled = true
20+
igw_id = [module.vpc.igw_id]
21+
ipv4_cidr_block = [module.vpc.vpc_cidr_block]
22+
nat_gateway_enabled = false
2123
nat_instance_enabled = false
2224

2325
context = module.this.context

examples/vpc/versions.tf

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
terraform {
2+
required_version = ">= 1.3"
3+
4+
required_providers {
5+
aws = {
6+
source = "hashicorp/aws"
7+
version = ">= 5.0"
8+
}
9+
}
10+
}

main.tf

+15-23
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ resource "random_string" "bucket_prefix" {
5959
}
6060

6161
locals {
62-
cache_bucket_name = "${module.this.id}${var.cache_bucket_suffix_enabled ? "-${join("", random_string.bucket_prefix.*.result)}" : ""}"
62+
cache_bucket_name = "${module.this.id}${var.cache_bucket_suffix_enabled ? "-${join("", random_string.bucket_prefix[*].result)}" : ""}"
6363

6464
## Clean up the bucket name to use only hyphens, and trim its length to 63 characters.
6565
## As per https://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html
@@ -71,7 +71,7 @@ locals {
7171

7272
s3_cache_enabled = var.cache_type == "S3"
7373
create_s3_cache_bucket = local.s3_cache_enabled && var.s3_cache_bucket_name == null
74-
s3_bucket_name = local.create_s3_cache_bucket ? join("", aws_s3_bucket.cache_bucket.*.bucket) : var.s3_cache_bucket_name
74+
s3_bucket_name = local.create_s3_cache_bucket ? join("", aws_s3_bucket.cache_bucket[*].bucket) : var.s3_cache_bucket_name
7575

7676
## This is the magic where a map of a list of maps is generated
7777
## and used to conditionally add the cache bucket option to the
@@ -134,7 +134,7 @@ resource "aws_iam_policy" "default_cache_bucket" {
134134

135135
name = "${module.this.id}-cache-bucket"
136136
path = var.iam_policy_path
137-
policy = join("", data.aws_iam_policy_document.permissions_cache_bucket.*.json)
137+
policy = join("", data.aws_iam_policy_document.permissions_cache_bucket[*].json)
138138
tags = module.this.tags
139139
}
140140

@@ -187,8 +187,8 @@ data "aws_iam_policy_document" "permissions" {
187187
effect = "Allow"
188188

189189
resources = [
190-
join("", data.aws_s3_bucket.secondary_artifact.*.arn),
191-
"${join("", data.aws_s3_bucket.secondary_artifact.*.arn)}/*",
190+
join("", data.aws_s3_bucket.secondary_artifact[*].arn),
191+
"${join("", data.aws_s3_bucket.secondary_artifact[*].arn)}/*",
192192
]
193193
}
194194
}
@@ -248,8 +248,8 @@ data "aws_iam_policy_document" "vpc_permissions" {
248248

249249
data "aws_iam_policy_document" "combined_permissions" {
250250
override_policy_documents = compact([
251-
join("", data.aws_iam_policy_document.permissions.*.json),
252-
var.vpc_config != {} ? join("", data.aws_iam_policy_document.vpc_permissions.*.json) : null
251+
join("", data.aws_iam_policy_document.permissions[*].json),
252+
var.vpc_config != {} ? join("", data.aws_iam_policy_document.vpc_permissions[*].json) : null
253253
])
254254
}
255255

@@ -265,22 +265,22 @@ data "aws_iam_policy_document" "permissions_cache_bucket" {
265265
effect = "Allow"
266266

267267
resources = [
268-
join("", aws_s3_bucket.cache_bucket.*.arn),
269-
"${join("", aws_s3_bucket.cache_bucket.*.arn)}/*",
268+
join("", aws_s3_bucket.cache_bucket[*].arn),
269+
"${join("", aws_s3_bucket.cache_bucket[*].arn)}/*",
270270
]
271271
}
272272
}
273273

274274
resource "aws_iam_role_policy_attachment" "default" {
275275
count = module.this.enabled ? 1 : 0
276-
policy_arn = join("", aws_iam_policy.default.*.arn)
277-
role = join("", aws_iam_role.default.*.id)
276+
policy_arn = join("", aws_iam_policy.default[*].arn)
277+
role = join("", aws_iam_role.default[*].id)
278278
}
279279

280280
resource "aws_iam_role_policy_attachment" "default_cache_bucket" {
281281
count = module.this.enabled && local.s3_cache_enabled ? 1 : 0
282-
policy_arn = join("", aws_iam_policy.default_cache_bucket.*.arn)
283-
role = join("", aws_iam_role.default.*.id)
282+
policy_arn = join("", aws_iam_policy.default_cache_bucket[*].arn)
283+
role = join("", aws_iam_role.default[*].id)
284284
}
285285

286286
resource "aws_codebuild_source_credential" "authorization" {
@@ -296,7 +296,7 @@ resource "aws_codebuild_project" "default" {
296296
name = module.this.id
297297
description = var.description
298298
concurrent_build_limit = var.concurrent_build_limit
299-
service_role = join("", aws_iam_role.default.*.arn)
299+
service_role = join("", aws_iam_role.default[*].arn)
300300
badge_enabled = var.badge_enabled
301301
build_timeout = var.build_timeout
302302
source_version = var.source_version != "" ? var.source_version : null
@@ -325,7 +325,7 @@ resource "aws_codebuild_project" "default" {
325325
type = "S3"
326326
location = var.secondary_artifact_location
327327
artifact_identifier = var.secondary_artifact_identifier
328-
encryption_disabled = ! var.secondary_artifact_encryption_enabled
328+
encryption_disabled = !var.secondary_artifact_encryption_enabled
329329
# According to AWS documention, in order to have the artifacts written
330330
# to the root of the bucket, the 'namespace_type' should be 'NONE'
331331
# (which is the default), 'name' should be '/', and 'path' should be
@@ -411,14 +411,6 @@ resource "aws_codebuild_project" "default" {
411411
report_build_status = var.report_build_status
412412
git_clone_depth = var.git_clone_depth != null ? var.git_clone_depth : null
413413

414-
dynamic "auth" {
415-
for_each = var.private_repository ? [""] : []
416-
content {
417-
type = "OAUTH"
418-
resource = join("", aws_codebuild_source_credential.authorization.*.id)
419-
}
420-
}
421-
422414
dynamic "git_submodules_config" {
423415
for_each = var.fetch_git_submodules ? [""] : []
424416
content {

0 commit comments

Comments
 (0)