|
| 1 | +/* |
| 2 | +Copyright 2025 The Kubernetes Authors. |
| 3 | +
|
| 4 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +you may not use this file except in compliance with the License. |
| 6 | +You may obtain a copy of the License at |
| 7 | +
|
| 8 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +
|
| 10 | +Unless required by applicable law or agreed to in writing, software |
| 11 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +See the License for the specific language governing permissions and |
| 14 | +limitations under the License. |
| 15 | +*/ |
| 16 | + |
| 17 | +## Used by kOps to store the state of the kOps created |
| 18 | +resource "aws_s3_bucket" "kops_state_store" { |
| 19 | + provider = aws.kops-infra-ci |
| 20 | + bucket = "k8s-kops-ci-prow-state-store" |
| 21 | + tags = merge(var.tags, var.janitor_tags, { |
| 22 | + "region" = data.aws_region.current.region |
| 23 | + }) |
| 24 | +} |
| 25 | + |
| 26 | +resource "aws_s3_bucket_ownership_controls" "kops_state_store" { |
| 27 | + provider = aws.kops-infra-ci |
| 28 | + bucket = aws_s3_bucket.kops_state_store.id |
| 29 | + rule { |
| 30 | + object_ownership = "BucketOwnerPreferred" |
| 31 | + } |
| 32 | +} |
| 33 | + |
| 34 | +resource "aws_s3_bucket_acl" "kops_state_store" { |
| 35 | + provider = aws.kops-infra-ci |
| 36 | + bucket = aws_s3_bucket.kops_state_store.id |
| 37 | + acl = "public-read" |
| 38 | + |
| 39 | + depends_on = [ |
| 40 | + aws_s3_bucket_ownership_controls.kops_state_store, |
| 41 | + aws_s3_bucket_public_access_block.kops_state_store |
| 42 | + ] |
| 43 | +} |
| 44 | + |
| 45 | +resource "aws_s3_bucket_public_access_block" "kops_state_store" { |
| 46 | + provider = aws.kops-infra-ci |
| 47 | + bucket = aws_s3_bucket.kops_state_store.id |
| 48 | + |
| 49 | + block_public_acls = false |
| 50 | + block_public_policy = false |
| 51 | + ignore_public_acls = false |
| 52 | + restrict_public_buckets = false |
| 53 | +} |
| 54 | + |
| 55 | + |
| 56 | +## Used by kOps for hosting OIDC documents |
| 57 | +resource "aws_s3_bucket" "kops_oidc_store" { |
| 58 | + provider = aws.kops-infra-ci |
| 59 | + bucket = "k8s-kops-ci-prow" |
| 60 | + tags = merge(var.tags, var.janitor_tags, { |
| 61 | + "region" = data.aws_region.current.region |
| 62 | + }) |
| 63 | +} |
| 64 | + |
| 65 | +resource "aws_s3_bucket_ownership_controls" "kops_oidc_store" { |
| 66 | + provider = aws.kops-infra-ci |
| 67 | + bucket = aws_s3_bucket.kops_oidc_store.id |
| 68 | + rule { |
| 69 | + object_ownership = "BucketOwnerPreferred" |
| 70 | + } |
| 71 | +} |
| 72 | + |
| 73 | +resource "aws_s3_bucket_public_access_block" "kops_oidc_store" { |
| 74 | + provider = aws.kops-infra-ci |
| 75 | + bucket = aws_s3_bucket.kops_oidc_store.id |
| 76 | + |
| 77 | + block_public_acls = false |
| 78 | + block_public_policy = false |
| 79 | + ignore_public_acls = false |
| 80 | + restrict_public_buckets = false |
| 81 | +} |
| 82 | + |
| 83 | +resource "aws_s3_bucket_acl" "kops_oidc_store" { |
| 84 | + provider = aws.kops-infra-ci |
| 85 | + bucket = aws_s3_bucket.kops_oidc_store.id |
| 86 | + acl = "public-read" |
| 87 | +} |
0 commit comments