Skip to content
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

Unable to create correctly a pinpoint aws app #25861

Closed
tre7roja opened this issue Jul 18, 2022 · 4 comments · Fixed by #38323
Closed

Unable to create correctly a pinpoint aws app #25861

tre7roja opened this issue Jul 18, 2022 · 4 comments · Fixed by #38323
Labels
bug Addresses a defect in current functionality. service/iam Issues and PRs that pertain to the iam service. service/pinpoint Issues and PRs that pertain to the pinpoint service. stale Old or inactive issues managed by automation, if no further action taken these will get closed.
Milestone

Comments

@tre7roja
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform CLI and Terraform AWS Provider Version

Terraform v1.2.5
on linux_amd64

  • provider registry.terraform.io/hashicorp/archive v2.2.0
  • provider registry.terraform.io/hashicorp/aws v4.22.0

Affected Resource(s)

  • aws_pinpoint_app

Terraform Configuration Files

resource "aws_pinpoint_app" "pinpoint_aws_app_sms_app" {
  provider = aws.dev
  name = "pinpoint-aws-app-1"

  campaign_hook {}

  limits {
    daily               = 0
    maximum_duration    = 60
    messages_per_second = 20000
    total               = 0
  }

provider (use Aws SSO - aws configure sso - to create profile)

provider "aws" {
  profile = "AWSAdministratorAccess-accountA"
  region  = "ca-central-1"
  alias   = "dev"

  assume_role {
    role_arn = "arn:aws:iam::accountB:role/role-A"
  }
}

Role A

resource "aws_iam_role" "assume_role_A" {
  name                = "role-A"
  assume_role_policy  = data.aws_iam_policy_document.assume_role_A.json
  managed_policy_arns = [
    var.policy_pinpoint_create_arn,
  ]
  tags                = {
    env = var.env
  }
}
data "aws_iam_policy_document" "assume_role_A" {
  statement {
    actions = [
      "sts:AssumeRole",
      "sts:TagSession",
      "sts:SetSourceIdentity"
    ]
    principals {
      type        = "AWS"
      identifiers = ["arn:aws:iam::${var.principal_assume_role}:root"]
    }
  }
}

Policy policy_pinpoint_create_arn

resource "aws_iam_policy" "policy_pinpoint_create" {
  description = "iam policy pinpoint"
  name        = "policy-pinpoint-create"
  path        = "/"
  policy = jsonencode(
    {
      Statement = [
        {
          Action = [
            "mobiletargeting:CreateSegment",
            "mobiletargeting:CreateRecommenderConfiguration",
            "mobiletargeting:GetSegment",
            "mobiletargeting:DeleteUserEndpoints",
            "mobiletargeting:GetSegmentExportJobs",
            "mobiletargeting:UpdateBaiduChannel",
            "mobiletargeting:DeleteSmsChannel",
            "mobiletargeting:UpdateSmsTemplate",
            "mobiletargeting:GetAdmChannel",
            "mobiletargeting:DeleteApnsVoipSandboxChannel",
            "mobiletargeting:CreateSmsTemplate",
            "mobiletargeting:DeleteVoiceChannel",
            "mobiletargeting:UpdateInAppTemplate",
            "mobiletargeting:DeleteCampaign",
            "mobiletargeting:GetVoiceChannel",
            "mobiletargeting:GetSegments",
            "mobiletargeting:CreateEmailTemplate",
            "mobiletargeting:CreateCampaign",
            "mobiletargeting:UpdateRecommenderConfiguration",
            "mobiletargeting:UpdatePushTemplate",
            "mobiletargeting:DeleteSmsTemplate",
            "mobiletargeting:UpdateEndpointsBatch",
            "mobiletargeting:CreateExportJob",
            "mobiletargeting:GetInAppMessages",
            "mobiletargeting:DeleteBaiduChannel",
            "mobiletargeting:GetUserEndpoints",
            "mobiletargeting:GetApnsVoipChannel",
            "mobiletargeting:GetJourneyExecutionActivityMetrics",
            "mobiletargeting:UpdateAdmChannel",
            "mobiletargeting:UntagResource",
            "mobiletargeting:GetPushTemplate",
            "mobiletargeting:UpdateEmailTemplate",
            "mobiletargeting:SendOTPMessage",
            "mobiletargeting:DeleteApnsVoipChannel",
            "mobiletargeting:GetSegmentImportJobs",
            "mobiletargeting:DeletePushTemplate",
            "mobiletargeting:GetCampaignActivities",
            "mobiletargeting:PutEventStream",
            "mobiletargeting:CreateJourney",
            "mobiletargeting:GetJourney",
            "mobiletargeting:UpdateApnsVoipChannel",
            "mobiletargeting:ListTemplateVersions",
            "mobiletargeting:UpdateSegment",
            "mobiletargeting:PutEvents",
            "mobiletargeting:GetApnsChannel",
            "mobiletargeting:GetCampaignDateRangeKpi",
            "mobiletargeting:UpdateGcmChannel",
            "mobiletargeting:UpdateSmsChannel",
            "mobiletargeting:GetImportJob",
            "mobiletargeting:GetEndpoint",
            "mobiletargeting:GetImportJobs",
            "mobiletargeting:ListJourneys",
            "mobiletargeting:GetReports",
            "mobiletargeting:UpdateCampaign",
            "mobiletargeting:GetJourneyDateRangeKpi",
            "mobiletargeting:DeleteAdmChannel",
            "mobiletargeting:UpdateVoiceTemplate",
            "mobiletargeting:UpdateTemplateActiveVersion",
            "mobiletargeting:ListTemplates",
            "mobiletargeting:RemoveAttributes",
            "mobiletargeting:UpdateApnsChannel",
            "mobiletargeting:DeleteSegment",
            "mobiletargeting:UpdateJourney",
            "mobiletargeting:GetEmailTemplate",
            "mobiletargeting:DeleteApnsSandboxChannel",
            "mobiletargeting:GetSmsTemplate",
            "mobiletargeting:GetEmailChannel",
            "mobiletargeting:GetApnsVoipSandboxChannel",
            "mobiletargeting:UpdateJourneyState",
            "mobiletargeting:GetCampaignVersions",
            "mobiletargeting:GetSmsChannel",
            "mobiletargeting:GetRecommenderConfiguration",
            "mobiletargeting:DeleteEmailTemplate",
            "mobiletargeting:GetExportJob",
            "mobiletargeting:GetVoiceTemplate",
            "mobiletargeting:GetExportJobs",
            "mobiletargeting:DeleteGcmChannel",
            "mobiletargeting:DeleteApnsChannel",
            "mobiletargeting:GetEventStream",
            "mobiletargeting:DeleteEventStream",
            "mobiletargeting:GetCampaignVersion",
            "mobiletargeting:GetApplicationSettings",
            "mobiletargeting:GetSegmentVersions",
            "mobiletargeting:DeleteEndpoint",
            "mobiletargeting:GetChannels",
            "mobiletargeting:GetApplicationDateRangeKpi",
            "mobiletargeting:GetCampaign",
            "mobiletargeting:DeleteJourney",
            "mobiletargeting:SendUsersMessages",
            "mobiletargeting:UpdateEmailChannel",
            "mobiletargeting:GetInAppTemplate",
            "mobiletargeting:CreateInAppTemplate",
            "mobiletargeting:UpdateApnsVoipSandboxChannel",
            "mobiletargeting:CreateApp",
            "mobiletargeting:GetCampaigns",
            "mobiletargeting:DeleteVoiceTemplate",
            "mobiletargeting:GetSegmentVersion",
            "mobiletargeting:SendMessages",
            "mobiletargeting:GetApp",
            "mobiletargeting:DeleteEmailChannel",
            "mobiletargeting:PhoneNumberValidate",
            "mobiletargeting:UpdateEndpoint",
            "mobiletargeting:CreateImportJob",
            "mobiletargeting:GetApnsSandboxChannel",
            "mobiletargeting:UpdateApplicationSettings",
            "mobiletargeting:GetBaiduChannel",
            "mobiletargeting:UpdateApnsSandboxChannel",
            "mobiletargeting:GetApps",
            "mobiletargeting:DeleteRecommenderConfiguration",
            "mobiletargeting:ListTagsForResource",
            "mobiletargeting:CreateVoiceTemplate",
            "mobiletargeting:TagResource",
            "mobiletargeting:DeleteApp",
            "mobiletargeting:GetGcmChannel",
            "mobiletargeting:DeleteInAppTemplate",
            "mobiletargeting:GetJourneyExecutionMetrics",
            "mobiletargeting:VerifyOTPMessage",
            "mobiletargeting:UpdateVoiceChannel",
            "mobiletargeting:GetRecommenderConfigurations",
            "mobiletargeting:CreatePushTemplate"
          ]
          Condition = {
            IpAddress = {
              "aws:SourceIp" = "*.*.*.*"
            }
          }
          Effect = "Allow"
          Resource = "*":q

          Sid = "VisualEditor0"
        },
      ]
      Version = "2012-10-17"
    }
  )
  tags = {
    env = var.env
  }
  tags_all = {}
}

Debug Output

https://gist.github.com/tre7roja/c11eef1dcac5161edee318e3431f2d4d

Panic Output

https://gist.github.com/tre7roja/fc5a08fdfa157f26e1c4ce48bf7e6681

Expected Behavior

Creation of pinpoint project correctly

Actual Behavior

The project is created in AWS but not in terraform state.

Steps to Reproduce

  1. terraform apply

Important Factoids

Use AWS SSO
Use assume role
Use Backend S3/DynamoDB

References

  • #0000
@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. service/iam Issues and PRs that pertain to the iam service. service/pinpoint Issues and PRs that pertain to the pinpoint service. labels Jul 18, 2022
@justinretzolk justinretzolk added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Jul 21, 2022
Copy link

Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label.

If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!

@github-actions github-actions bot added the stale Old or inactive issues managed by automation, if no further action taken these will get closed. label Jul 11, 2024
Copy link

Warning

This issue has been closed, meaning that any additional comments are hard for our team to see. Please assume that the maintainers will not see them.

Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed.

@github-actions github-actions bot added this to the v5.59.0 milestone Jul 11, 2024
Copy link

This functionality has been released in v5.59.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. Thank you!

Copy link

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/iam Issues and PRs that pertain to the iam service. service/pinpoint Issues and PRs that pertain to the pinpoint service. stale Old or inactive issues managed by automation, if no further action taken these will get closed.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants