Skip to content

Commit

Permalink
Correctly set the alt type for 3 resources with iam.PolicyDocument
Browse files Browse the repository at this point in the history
- `aws_cloudwatch_log_resource_policy.policy_document`
- `aws_ecr_registry_policy.policy`
- `aws_sns_topic_policy.policy`

This is a breaking change for Go and Typescript if users were reading the `PolicyDocument`
field on LogResourcePolicyArgs or on LogResourcePolicy.

This was discovered as part of
pulumi/pulumi-terraform-bridge#1758.
  • Loading branch information
iwahbe committed Mar 27, 2024
1 parent c3c2567 commit 86621a5
Show file tree
Hide file tree
Showing 8 changed files with 87 additions and 33 deletions.
54 changes: 54 additions & 0 deletions provider/cmd/pulumi-resource-aws/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -184553,6 +184553,15 @@
"inputProperties": {
"policyDocument": {
"type": "string",
"oneOf": [
{
"type": "string"
},
{
"type": "string",
"$ref": "#/types/aws:iam/documents:PolicyDocument"
}
],
"description": "Details of the resource policy, including the identity of the principal that is enabled to put logs to this account. This is formatted as a JSON string. Maximum length of 5120 characters.\n"
},
"policyName": {
Expand All @@ -184570,6 +184579,15 @@
"properties": {
"policyDocument": {
"type": "string",
"oneOf": [
{
"type": "string"
},
{
"type": "string",
"$ref": "#/types/aws:iam/documents:PolicyDocument"
}
],
"description": "Details of the resource policy, including the identity of the principal that is enabled to put logs to this account. This is formatted as a JSON string. Maximum length of 5120 characters.\n"
},
"policyName": {
Expand Down Expand Up @@ -229034,6 +229052,15 @@
"inputProperties": {
"policy": {
"type": "string",
"oneOf": [
{
"type": "string"
},
{
"type": "string",
"$ref": "#/types/aws:iam/documents:PolicyDocument"
}
],
"description": "The policy document. This is a JSON formatted string.\n"
}
},
Expand All @@ -229045,6 +229072,15 @@
"properties": {
"policy": {
"type": "string",
"oneOf": [
{
"type": "string"
},
{
"type": "string",
"$ref": "#/types/aws:iam/documents:PolicyDocument"
}
],
"description": "The policy document. This is a JSON formatted string.\n"
},
"registryId": {
Expand Down Expand Up @@ -333122,6 +333158,15 @@
},
"policy": {
"type": "string",
"oneOf": [
{
"type": "string"
},
{
"type": "string",
"$ref": "#/types/aws:iam/documents:PolicyDocument"
}
],
"description": "The fully-formed AWS policy as JSON.\n"
}
},
Expand All @@ -333143,6 +333188,15 @@
},
"policy": {
"type": "string",
"oneOf": [
{
"type": "string"
},
{
"type": "string",
"$ref": "#/types/aws:iam/documents:PolicyDocument"
}
],
"description": "The fully-formed AWS policy as JSON.\n"
}
},
Expand Down
24 changes: 9 additions & 15 deletions provider/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -1335,11 +1335,9 @@ func ProviderFromMeta(metaInfo *tfbridge.MetadataInfo) *tfbridge.ProviderInfo {
Tok: awsResource(cloudwatchMod, "LogResourcePolicy"),
Fields: map[string]*tfbridge.SchemaInfo{
"policy_document": {
Elem: &tfbridge.SchemaInfo{
Type: "string",
AltTypes: []tokens.Type{awsType(iamMod, "documents", "PolicyDocument")},
Transform: tfbridge.TransformJSONDocument,
},
Type: "string",
AltTypes: []tokens.Type{awsType(iamMod, "documents", "PolicyDocument")},
Transform: tfbridge.TransformJSONDocument,
},
},
},
Expand Down Expand Up @@ -2087,11 +2085,9 @@ func ProviderFromMeta(metaInfo *tfbridge.MetadataInfo) *tfbridge.ProviderInfo {
Tok: awsResource(ecrMod, "RegistryPolicy"),
Fields: map[string]*tfbridge.SchemaInfo{
"policy": {
Elem: &tfbridge.SchemaInfo{
Type: "string",
AltTypes: []tokens.Type{awsType(iamMod, "documents", "PolicyDocument")},
Transform: tfbridge.TransformJSONDocument,
},
Type: "string",
AltTypes: []tokens.Type{awsType(iamMod, "documents", "PolicyDocument")},
Transform: tfbridge.TransformJSONDocument,
},
},
},
Expand Down Expand Up @@ -3851,11 +3847,9 @@ func ProviderFromMeta(metaInfo *tfbridge.MetadataInfo) *tfbridge.ProviderInfo {
Tok: awsResource(snsMod, "TopicPolicy"),
Fields: map[string]*tfbridge.SchemaInfo{
"policy": {
Elem: &tfbridge.SchemaInfo{
Type: "string",
AltTypes: []tokens.Type{awsType(iamMod, "documents", "PolicyDocument")},
Transform: tfbridge.TransformJSONDocument,
},
Type: "string",
AltTypes: []tokens.Type{awsType(iamMod, "documents", "PolicyDocument")},
Transform: tfbridge.TransformJSONDocument,
},
},
},
Expand Down
8 changes: 4 additions & 4 deletions sdk/go/aws/cloudwatch/logResourcePolicy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions sdk/go/aws/ecr/registryPolicy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions sdk/go/aws/sns/topicPolicy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions sdk/nodejs/cloudwatch/logResourcePolicy.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions sdk/nodejs/ecr/registryPolicy.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions sdk/nodejs/sns/topicPolicy.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 86621a5

Please sign in to comment.