-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tests/resource/codebuild_project: Fix hardcoded regions #16967
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me 🚀
My acceptance testing output matches yours.
# InvalidInputException: CodeBuild currently doesn't support VPC in us-west-2d, please select subnets in other availability zones. | ||
exclude_zone_ids = ["usw2-az4"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Verified this removal is safe via:
terraform {
required_version = "0.14.3"
required_providers {
aws = {
source = "hashicorp/aws"
version = "3.22.0"
}
}
}
provider "aws" {
region = "us-west-2"
}
resource "aws_iam_role" "test" {
name = "16967-test"
assume_role_policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "codebuild.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
EOF
}
resource "aws_iam_role_policy" "test" {
role = aws_iam_role.test.name
policy = <<POLICY
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Resource": [
"*"
],
"Action": [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents"
]
},
{
"Effect": "Allow",
"Action": [
"ec2:CreateNetworkInterface",
"ec2:DescribeDhcpOptions",
"ec2:DescribeNetworkInterfaces",
"ec2:DeleteNetworkInterface",
"ec2:DescribeSubnets",
"ec2:DescribeSecurityGroups",
"ec2:DescribeVpcs"
],
"Resource": "*"
},
{
"Effect": "Allow",
"Action": [
"s3:*"
],
"Resource": "*"
}
]
}
POLICY
}
resource "aws_vpc" "test" {
cidr_block = "10.0.0.0/16"
}
resource "aws_subnet" "test" {
count = 1
availability_zone_id = "usw2-az4"
cidr_block = "10.0.0.0/24"
vpc_id = aws_vpc.test.id
tags = {
Name = "tf-acc-codebuild-project"
}
}
resource "aws_security_group" "test" {
vpc_id = aws_vpc.test.id
}
resource "aws_codebuild_project" "test" {
name = "16967-test"
service_role = aws_iam_role.test.arn
artifacts {
type = "NO_ARTIFACTS"
}
environment {
compute_type = "BUILD_GENERAL1_SMALL"
image = "2"
type = "LINUX_CONTAINER"
}
source {
location = "https://github.com/hashicorp/packer.git"
type = "GITHUB"
}
vpc_config {
security_group_ids = [aws_security_group.test.id]
subnets = aws_subnet.test[*].id
vpc_id = aws_vpc.test.id
}
}
$ terraform apply
...
aws_codebuild_project.test: Creating...
aws_codebuild_project.test: Creation complete after 6s [id=arn:aws:codebuild:us-west-2:--OMITTED--:project/16967-test]
Apply complete! Resources: 6 added, 0 changed, 0 destroyed.
This has been released in version 3.23.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks! |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Community Note
Relates #12995 Phase 2
Release note for CHANGELOG:
Acceptance Tests
GovCloud
Failures are unrelated and tracked elsewhere.
Acceptance Tests
us-west-2