github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/s3/accountPublicAccessBlock.go (about) 1 // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT. 2 // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! *** 3 4 package s3 5 6 import ( 7 "context" 8 "reflect" 9 10 "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal" 11 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 12 ) 13 14 // Manages S3 account-level Public Access Block configuration. For more information about these settings, see the [AWS S3 Block Public Access documentation](https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html). 15 // 16 // > **NOTE:** Each AWS account may only have one S3 Public Access Block configuration. Multiple configurations of the resource against the same AWS account will cause a perpetual difference. 17 // 18 // > Advanced usage: To use a custom API endpoint for this resource, use the `s3control` endpoint provider configuration, not the `s3` endpoint provider configuration. 19 // 20 // ## Example Usage 21 // 22 // <!--Start PulumiCodeChooser --> 23 // ```go 24 // package main 25 // 26 // import ( 27 // 28 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/s3" 29 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 30 // 31 // ) 32 // 33 // func main() { 34 // pulumi.Run(func(ctx *pulumi.Context) error { 35 // _, err := s3.NewAccountPublicAccessBlock(ctx, "example", &s3.AccountPublicAccessBlockArgs{ 36 // BlockPublicAcls: pulumi.Bool(true), 37 // BlockPublicPolicy: pulumi.Bool(true), 38 // }) 39 // if err != nil { 40 // return err 41 // } 42 // return nil 43 // }) 44 // } 45 // 46 // ``` 47 // <!--End PulumiCodeChooser --> 48 // 49 // ## Import 50 // 51 // Using `pulumi import`, import `aws_s3_account_public_access_block` using the AWS account ID. For example: 52 // 53 // ```sh 54 // $ pulumi import aws:s3/accountPublicAccessBlock:AccountPublicAccessBlock example 123456789012 55 // ``` 56 type AccountPublicAccessBlock struct { 57 pulumi.CustomResourceState 58 59 // AWS account ID to configure. Defaults to automatically determined account ID of the this provider AWS provider. 60 AccountId pulumi.StringOutput `pulumi:"accountId"` 61 // Whether Amazon S3 should block public ACLs for buckets in this account. Defaults to `false`. Enabling this setting does not affect existing policies or ACLs. When set to `true` causes the following behavior: 62 // * PUT Bucket acl and PUT Object acl calls will fail if the specified ACL allows public access. 63 // * PUT Object calls fail if the request includes a public ACL. 64 BlockPublicAcls pulumi.BoolPtrOutput `pulumi:"blockPublicAcls"` 65 // Whether Amazon S3 should block public bucket policies for buckets in this account. Defaults to `false`. Enabling this setting does not affect existing bucket policies. When set to `true` causes Amazon S3 to: 66 // * Reject calls to PUT Bucket policy if the specified bucket policy allows public access. 67 BlockPublicPolicy pulumi.BoolPtrOutput `pulumi:"blockPublicPolicy"` 68 // Whether Amazon S3 should ignore public ACLs for buckets in this account. Defaults to `false`. Enabling this setting does not affect the persistence of any existing ACLs and doesn't prevent new public ACLs from being set. When set to `true` causes Amazon S3 to: 69 // * Ignore all public ACLs on buckets in this account and any objects that they contain. 70 IgnorePublicAcls pulumi.BoolPtrOutput `pulumi:"ignorePublicAcls"` 71 // Whether Amazon S3 should restrict public bucket policies for buckets in this account. Defaults to `false`. Enabling this setting does not affect previously stored bucket policies, except that public and cross-account access within any public bucket policy, including non-public delegation to specific accounts, is blocked. When set to `true`: 72 // * Only the bucket owner and AWS Services can access buckets with public policies. 73 RestrictPublicBuckets pulumi.BoolPtrOutput `pulumi:"restrictPublicBuckets"` 74 } 75 76 // NewAccountPublicAccessBlock registers a new resource with the given unique name, arguments, and options. 77 func NewAccountPublicAccessBlock(ctx *pulumi.Context, 78 name string, args *AccountPublicAccessBlockArgs, opts ...pulumi.ResourceOption) (*AccountPublicAccessBlock, error) { 79 if args == nil { 80 args = &AccountPublicAccessBlockArgs{} 81 } 82 83 opts = internal.PkgResourceDefaultOpts(opts) 84 var resource AccountPublicAccessBlock 85 err := ctx.RegisterResource("aws:s3/accountPublicAccessBlock:AccountPublicAccessBlock", name, args, &resource, opts...) 86 if err != nil { 87 return nil, err 88 } 89 return &resource, nil 90 } 91 92 // GetAccountPublicAccessBlock gets an existing AccountPublicAccessBlock resource's state with the given name, ID, and optional 93 // state properties that are used to uniquely qualify the lookup (nil if not required). 94 func GetAccountPublicAccessBlock(ctx *pulumi.Context, 95 name string, id pulumi.IDInput, state *AccountPublicAccessBlockState, opts ...pulumi.ResourceOption) (*AccountPublicAccessBlock, error) { 96 var resource AccountPublicAccessBlock 97 err := ctx.ReadResource("aws:s3/accountPublicAccessBlock:AccountPublicAccessBlock", name, id, state, &resource, opts...) 98 if err != nil { 99 return nil, err 100 } 101 return &resource, nil 102 } 103 104 // Input properties used for looking up and filtering AccountPublicAccessBlock resources. 105 type accountPublicAccessBlockState struct { 106 // AWS account ID to configure. Defaults to automatically determined account ID of the this provider AWS provider. 107 AccountId *string `pulumi:"accountId"` 108 // Whether Amazon S3 should block public ACLs for buckets in this account. Defaults to `false`. Enabling this setting does not affect existing policies or ACLs. When set to `true` causes the following behavior: 109 // * PUT Bucket acl and PUT Object acl calls will fail if the specified ACL allows public access. 110 // * PUT Object calls fail if the request includes a public ACL. 111 BlockPublicAcls *bool `pulumi:"blockPublicAcls"` 112 // Whether Amazon S3 should block public bucket policies for buckets in this account. Defaults to `false`. Enabling this setting does not affect existing bucket policies. When set to `true` causes Amazon S3 to: 113 // * Reject calls to PUT Bucket policy if the specified bucket policy allows public access. 114 BlockPublicPolicy *bool `pulumi:"blockPublicPolicy"` 115 // Whether Amazon S3 should ignore public ACLs for buckets in this account. Defaults to `false`. Enabling this setting does not affect the persistence of any existing ACLs and doesn't prevent new public ACLs from being set. When set to `true` causes Amazon S3 to: 116 // * Ignore all public ACLs on buckets in this account and any objects that they contain. 117 IgnorePublicAcls *bool `pulumi:"ignorePublicAcls"` 118 // Whether Amazon S3 should restrict public bucket policies for buckets in this account. Defaults to `false`. Enabling this setting does not affect previously stored bucket policies, except that public and cross-account access within any public bucket policy, including non-public delegation to specific accounts, is blocked. When set to `true`: 119 // * Only the bucket owner and AWS Services can access buckets with public policies. 120 RestrictPublicBuckets *bool `pulumi:"restrictPublicBuckets"` 121 } 122 123 type AccountPublicAccessBlockState struct { 124 // AWS account ID to configure. Defaults to automatically determined account ID of the this provider AWS provider. 125 AccountId pulumi.StringPtrInput 126 // Whether Amazon S3 should block public ACLs for buckets in this account. Defaults to `false`. Enabling this setting does not affect existing policies or ACLs. When set to `true` causes the following behavior: 127 // * PUT Bucket acl and PUT Object acl calls will fail if the specified ACL allows public access. 128 // * PUT Object calls fail if the request includes a public ACL. 129 BlockPublicAcls pulumi.BoolPtrInput 130 // Whether Amazon S3 should block public bucket policies for buckets in this account. Defaults to `false`. Enabling this setting does not affect existing bucket policies. When set to `true` causes Amazon S3 to: 131 // * Reject calls to PUT Bucket policy if the specified bucket policy allows public access. 132 BlockPublicPolicy pulumi.BoolPtrInput 133 // Whether Amazon S3 should ignore public ACLs for buckets in this account. Defaults to `false`. Enabling this setting does not affect the persistence of any existing ACLs and doesn't prevent new public ACLs from being set. When set to `true` causes Amazon S3 to: 134 // * Ignore all public ACLs on buckets in this account and any objects that they contain. 135 IgnorePublicAcls pulumi.BoolPtrInput 136 // Whether Amazon S3 should restrict public bucket policies for buckets in this account. Defaults to `false`. Enabling this setting does not affect previously stored bucket policies, except that public and cross-account access within any public bucket policy, including non-public delegation to specific accounts, is blocked. When set to `true`: 137 // * Only the bucket owner and AWS Services can access buckets with public policies. 138 RestrictPublicBuckets pulumi.BoolPtrInput 139 } 140 141 func (AccountPublicAccessBlockState) ElementType() reflect.Type { 142 return reflect.TypeOf((*accountPublicAccessBlockState)(nil)).Elem() 143 } 144 145 type accountPublicAccessBlockArgs struct { 146 // AWS account ID to configure. Defaults to automatically determined account ID of the this provider AWS provider. 147 AccountId *string `pulumi:"accountId"` 148 // Whether Amazon S3 should block public ACLs for buckets in this account. Defaults to `false`. Enabling this setting does not affect existing policies or ACLs. When set to `true` causes the following behavior: 149 // * PUT Bucket acl and PUT Object acl calls will fail if the specified ACL allows public access. 150 // * PUT Object calls fail if the request includes a public ACL. 151 BlockPublicAcls *bool `pulumi:"blockPublicAcls"` 152 // Whether Amazon S3 should block public bucket policies for buckets in this account. Defaults to `false`. Enabling this setting does not affect existing bucket policies. When set to `true` causes Amazon S3 to: 153 // * Reject calls to PUT Bucket policy if the specified bucket policy allows public access. 154 BlockPublicPolicy *bool `pulumi:"blockPublicPolicy"` 155 // Whether Amazon S3 should ignore public ACLs for buckets in this account. Defaults to `false`. Enabling this setting does not affect the persistence of any existing ACLs and doesn't prevent new public ACLs from being set. When set to `true` causes Amazon S3 to: 156 // * Ignore all public ACLs on buckets in this account and any objects that they contain. 157 IgnorePublicAcls *bool `pulumi:"ignorePublicAcls"` 158 // Whether Amazon S3 should restrict public bucket policies for buckets in this account. Defaults to `false`. Enabling this setting does not affect previously stored bucket policies, except that public and cross-account access within any public bucket policy, including non-public delegation to specific accounts, is blocked. When set to `true`: 159 // * Only the bucket owner and AWS Services can access buckets with public policies. 160 RestrictPublicBuckets *bool `pulumi:"restrictPublicBuckets"` 161 } 162 163 // The set of arguments for constructing a AccountPublicAccessBlock resource. 164 type AccountPublicAccessBlockArgs struct { 165 // AWS account ID to configure. Defaults to automatically determined account ID of the this provider AWS provider. 166 AccountId pulumi.StringPtrInput 167 // Whether Amazon S3 should block public ACLs for buckets in this account. Defaults to `false`. Enabling this setting does not affect existing policies or ACLs. When set to `true` causes the following behavior: 168 // * PUT Bucket acl and PUT Object acl calls will fail if the specified ACL allows public access. 169 // * PUT Object calls fail if the request includes a public ACL. 170 BlockPublicAcls pulumi.BoolPtrInput 171 // Whether Amazon S3 should block public bucket policies for buckets in this account. Defaults to `false`. Enabling this setting does not affect existing bucket policies. When set to `true` causes Amazon S3 to: 172 // * Reject calls to PUT Bucket policy if the specified bucket policy allows public access. 173 BlockPublicPolicy pulumi.BoolPtrInput 174 // Whether Amazon S3 should ignore public ACLs for buckets in this account. Defaults to `false`. Enabling this setting does not affect the persistence of any existing ACLs and doesn't prevent new public ACLs from being set. When set to `true` causes Amazon S3 to: 175 // * Ignore all public ACLs on buckets in this account and any objects that they contain. 176 IgnorePublicAcls pulumi.BoolPtrInput 177 // Whether Amazon S3 should restrict public bucket policies for buckets in this account. Defaults to `false`. Enabling this setting does not affect previously stored bucket policies, except that public and cross-account access within any public bucket policy, including non-public delegation to specific accounts, is blocked. When set to `true`: 178 // * Only the bucket owner and AWS Services can access buckets with public policies. 179 RestrictPublicBuckets pulumi.BoolPtrInput 180 } 181 182 func (AccountPublicAccessBlockArgs) ElementType() reflect.Type { 183 return reflect.TypeOf((*accountPublicAccessBlockArgs)(nil)).Elem() 184 } 185 186 type AccountPublicAccessBlockInput interface { 187 pulumi.Input 188 189 ToAccountPublicAccessBlockOutput() AccountPublicAccessBlockOutput 190 ToAccountPublicAccessBlockOutputWithContext(ctx context.Context) AccountPublicAccessBlockOutput 191 } 192 193 func (*AccountPublicAccessBlock) ElementType() reflect.Type { 194 return reflect.TypeOf((**AccountPublicAccessBlock)(nil)).Elem() 195 } 196 197 func (i *AccountPublicAccessBlock) ToAccountPublicAccessBlockOutput() AccountPublicAccessBlockOutput { 198 return i.ToAccountPublicAccessBlockOutputWithContext(context.Background()) 199 } 200 201 func (i *AccountPublicAccessBlock) ToAccountPublicAccessBlockOutputWithContext(ctx context.Context) AccountPublicAccessBlockOutput { 202 return pulumi.ToOutputWithContext(ctx, i).(AccountPublicAccessBlockOutput) 203 } 204 205 // AccountPublicAccessBlockArrayInput is an input type that accepts AccountPublicAccessBlockArray and AccountPublicAccessBlockArrayOutput values. 206 // You can construct a concrete instance of `AccountPublicAccessBlockArrayInput` via: 207 // 208 // AccountPublicAccessBlockArray{ AccountPublicAccessBlockArgs{...} } 209 type AccountPublicAccessBlockArrayInput interface { 210 pulumi.Input 211 212 ToAccountPublicAccessBlockArrayOutput() AccountPublicAccessBlockArrayOutput 213 ToAccountPublicAccessBlockArrayOutputWithContext(context.Context) AccountPublicAccessBlockArrayOutput 214 } 215 216 type AccountPublicAccessBlockArray []AccountPublicAccessBlockInput 217 218 func (AccountPublicAccessBlockArray) ElementType() reflect.Type { 219 return reflect.TypeOf((*[]*AccountPublicAccessBlock)(nil)).Elem() 220 } 221 222 func (i AccountPublicAccessBlockArray) ToAccountPublicAccessBlockArrayOutput() AccountPublicAccessBlockArrayOutput { 223 return i.ToAccountPublicAccessBlockArrayOutputWithContext(context.Background()) 224 } 225 226 func (i AccountPublicAccessBlockArray) ToAccountPublicAccessBlockArrayOutputWithContext(ctx context.Context) AccountPublicAccessBlockArrayOutput { 227 return pulumi.ToOutputWithContext(ctx, i).(AccountPublicAccessBlockArrayOutput) 228 } 229 230 // AccountPublicAccessBlockMapInput is an input type that accepts AccountPublicAccessBlockMap and AccountPublicAccessBlockMapOutput values. 231 // You can construct a concrete instance of `AccountPublicAccessBlockMapInput` via: 232 // 233 // AccountPublicAccessBlockMap{ "key": AccountPublicAccessBlockArgs{...} } 234 type AccountPublicAccessBlockMapInput interface { 235 pulumi.Input 236 237 ToAccountPublicAccessBlockMapOutput() AccountPublicAccessBlockMapOutput 238 ToAccountPublicAccessBlockMapOutputWithContext(context.Context) AccountPublicAccessBlockMapOutput 239 } 240 241 type AccountPublicAccessBlockMap map[string]AccountPublicAccessBlockInput 242 243 func (AccountPublicAccessBlockMap) ElementType() reflect.Type { 244 return reflect.TypeOf((*map[string]*AccountPublicAccessBlock)(nil)).Elem() 245 } 246 247 func (i AccountPublicAccessBlockMap) ToAccountPublicAccessBlockMapOutput() AccountPublicAccessBlockMapOutput { 248 return i.ToAccountPublicAccessBlockMapOutputWithContext(context.Background()) 249 } 250 251 func (i AccountPublicAccessBlockMap) ToAccountPublicAccessBlockMapOutputWithContext(ctx context.Context) AccountPublicAccessBlockMapOutput { 252 return pulumi.ToOutputWithContext(ctx, i).(AccountPublicAccessBlockMapOutput) 253 } 254 255 type AccountPublicAccessBlockOutput struct{ *pulumi.OutputState } 256 257 func (AccountPublicAccessBlockOutput) ElementType() reflect.Type { 258 return reflect.TypeOf((**AccountPublicAccessBlock)(nil)).Elem() 259 } 260 261 func (o AccountPublicAccessBlockOutput) ToAccountPublicAccessBlockOutput() AccountPublicAccessBlockOutput { 262 return o 263 } 264 265 func (o AccountPublicAccessBlockOutput) ToAccountPublicAccessBlockOutputWithContext(ctx context.Context) AccountPublicAccessBlockOutput { 266 return o 267 } 268 269 // AWS account ID to configure. Defaults to automatically determined account ID of the this provider AWS provider. 270 func (o AccountPublicAccessBlockOutput) AccountId() pulumi.StringOutput { 271 return o.ApplyT(func(v *AccountPublicAccessBlock) pulumi.StringOutput { return v.AccountId }).(pulumi.StringOutput) 272 } 273 274 // Whether Amazon S3 should block public ACLs for buckets in this account. Defaults to `false`. Enabling this setting does not affect existing policies or ACLs. When set to `true` causes the following behavior: 275 // * PUT Bucket acl and PUT Object acl calls will fail if the specified ACL allows public access. 276 // * PUT Object calls fail if the request includes a public ACL. 277 func (o AccountPublicAccessBlockOutput) BlockPublicAcls() pulumi.BoolPtrOutput { 278 return o.ApplyT(func(v *AccountPublicAccessBlock) pulumi.BoolPtrOutput { return v.BlockPublicAcls }).(pulumi.BoolPtrOutput) 279 } 280 281 // Whether Amazon S3 should block public bucket policies for buckets in this account. Defaults to `false`. Enabling this setting does not affect existing bucket policies. When set to `true` causes Amazon S3 to: 282 // * Reject calls to PUT Bucket policy if the specified bucket policy allows public access. 283 func (o AccountPublicAccessBlockOutput) BlockPublicPolicy() pulumi.BoolPtrOutput { 284 return o.ApplyT(func(v *AccountPublicAccessBlock) pulumi.BoolPtrOutput { return v.BlockPublicPolicy }).(pulumi.BoolPtrOutput) 285 } 286 287 // Whether Amazon S3 should ignore public ACLs for buckets in this account. Defaults to `false`. Enabling this setting does not affect the persistence of any existing ACLs and doesn't prevent new public ACLs from being set. When set to `true` causes Amazon S3 to: 288 // * Ignore all public ACLs on buckets in this account and any objects that they contain. 289 func (o AccountPublicAccessBlockOutput) IgnorePublicAcls() pulumi.BoolPtrOutput { 290 return o.ApplyT(func(v *AccountPublicAccessBlock) pulumi.BoolPtrOutput { return v.IgnorePublicAcls }).(pulumi.BoolPtrOutput) 291 } 292 293 // Whether Amazon S3 should restrict public bucket policies for buckets in this account. Defaults to `false`. Enabling this setting does not affect previously stored bucket policies, except that public and cross-account access within any public bucket policy, including non-public delegation to specific accounts, is blocked. When set to `true`: 294 // * Only the bucket owner and AWS Services can access buckets with public policies. 295 func (o AccountPublicAccessBlockOutput) RestrictPublicBuckets() pulumi.BoolPtrOutput { 296 return o.ApplyT(func(v *AccountPublicAccessBlock) pulumi.BoolPtrOutput { return v.RestrictPublicBuckets }).(pulumi.BoolPtrOutput) 297 } 298 299 type AccountPublicAccessBlockArrayOutput struct{ *pulumi.OutputState } 300 301 func (AccountPublicAccessBlockArrayOutput) ElementType() reflect.Type { 302 return reflect.TypeOf((*[]*AccountPublicAccessBlock)(nil)).Elem() 303 } 304 305 func (o AccountPublicAccessBlockArrayOutput) ToAccountPublicAccessBlockArrayOutput() AccountPublicAccessBlockArrayOutput { 306 return o 307 } 308 309 func (o AccountPublicAccessBlockArrayOutput) ToAccountPublicAccessBlockArrayOutputWithContext(ctx context.Context) AccountPublicAccessBlockArrayOutput { 310 return o 311 } 312 313 func (o AccountPublicAccessBlockArrayOutput) Index(i pulumi.IntInput) AccountPublicAccessBlockOutput { 314 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *AccountPublicAccessBlock { 315 return vs[0].([]*AccountPublicAccessBlock)[vs[1].(int)] 316 }).(AccountPublicAccessBlockOutput) 317 } 318 319 type AccountPublicAccessBlockMapOutput struct{ *pulumi.OutputState } 320 321 func (AccountPublicAccessBlockMapOutput) ElementType() reflect.Type { 322 return reflect.TypeOf((*map[string]*AccountPublicAccessBlock)(nil)).Elem() 323 } 324 325 func (o AccountPublicAccessBlockMapOutput) ToAccountPublicAccessBlockMapOutput() AccountPublicAccessBlockMapOutput { 326 return o 327 } 328 329 func (o AccountPublicAccessBlockMapOutput) ToAccountPublicAccessBlockMapOutputWithContext(ctx context.Context) AccountPublicAccessBlockMapOutput { 330 return o 331 } 332 333 func (o AccountPublicAccessBlockMapOutput) MapIndex(k pulumi.StringInput) AccountPublicAccessBlockOutput { 334 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *AccountPublicAccessBlock { 335 return vs[0].(map[string]*AccountPublicAccessBlock)[vs[1].(string)] 336 }).(AccountPublicAccessBlockOutput) 337 } 338 339 func init() { 340 pulumi.RegisterInputType(reflect.TypeOf((*AccountPublicAccessBlockInput)(nil)).Elem(), &AccountPublicAccessBlock{}) 341 pulumi.RegisterInputType(reflect.TypeOf((*AccountPublicAccessBlockArrayInput)(nil)).Elem(), AccountPublicAccessBlockArray{}) 342 pulumi.RegisterInputType(reflect.TypeOf((*AccountPublicAccessBlockMapInput)(nil)).Elem(), AccountPublicAccessBlockMap{}) 343 pulumi.RegisterOutputType(AccountPublicAccessBlockOutput{}) 344 pulumi.RegisterOutputType(AccountPublicAccessBlockArrayOutput{}) 345 pulumi.RegisterOutputType(AccountPublicAccessBlockMapOutput{}) 346 }