Skip to content

Commit

Permalink
[8.11](backport #1415) CloudFormation: Fix missing tags in cloud-secu…
Browse files Browse the repository at this point in the history
…rity account (#1423)

CloudFormation: Fix missing tags in cloud-security account (#1415)

This is a temporary fix that tags required resources for the build to
succeed. We can revert it after the QA cycle to find a more elegant
solution.

(cherry picked from commit d4ad5d4)

Co-authored-by: Orestis Floros <[email protected]>
  • Loading branch information
mergify[bot] and orestisfl authored Oct 16, 2023
1 parent c8c512a commit 458b331
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 75 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/test-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,3 @@ jobs:
if: github.event.inputs.cleanup-env == 'true'
run: |
just delete-cloud-env ${{ env.DEPLOYMENT_NAME }} '' "false"
- name: Tag CNVM Instance
if: github.event.inputs.cleanup-env == 'false'
env:
STACK_NAME: "${{ env.CNVM_STACK_NAME}}"
run: just create-cnvm-stack-tags ${{ env.AWS_REGION}} ${{ env.STACK_NAME }} '${{ env.AWS_DEFAULT_TAGS }} Key=owner,Value=${{ github.actor }}'
25 changes: 25 additions & 0 deletions deploy/cloudformation/elastic-agent-ec2-cnvm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ Parameters:
Description: The version of elastic-agent to install
Type: String

Conditions:
UseElasticTags: !Equals
- !Ref "AWS::AccountId"
- 704479110758

Resources:

# Security Group for EC2 instance
Expand Down Expand Up @@ -134,6 +139,26 @@ Resources:
- !Ref "AWS::StackId"
- Key: Task
Value: Vulnerability Management Scanner
- Key: division
Value: !If
- UseElasticTags
- engineering
- AWS::NoValue
- Key: org
Value: !If
- UseElasticTags
- security
- AWS::NoValue
- Key: team
Value: !If
- UseElasticTags
- cloud-security
- AWS::NoValue
- Key: project
Value: !If
- UseElasticTags
- cloudformation
- AWS::NoValue
ImageId: !Ref LatestAmiId
InstanceType: !Ref InstanceType
IamInstanceProfile: !Ref ElasticAgentInstanceProfile
Expand Down
25 changes: 25 additions & 0 deletions deploy/cloudformation/elastic-agent-ec2-cspm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ Parameters:
Description: The version of elastic-agent to install
Type: String

Conditions:
UseElasticTags: !Equals
- !Ref "AWS::AccountId"
- 704479110758

Resources:

# Security Group for EC2 instance
Expand Down Expand Up @@ -102,6 +107,26 @@ Resources:
- !Ref "AWS::StackId"
- Key: Task
Value: Cloud Security Posture Management Scanner
- Key: division
Value: !If
- UseElasticTags
- engineering
- AWS::NoValue
- Key: org
Value: !If
- UseElasticTags
- security
- AWS::NoValue
- Key: team
Value: !If
- UseElasticTags
- cloud-security
- AWS::NoValue
- Key: project
Value: !If
- UseElasticTags
- cloudformation
- AWS::NoValue
ImageId: !Ref LatestAmiId
InstanceType: !Ref InstanceType
IamInstanceProfile: !Ref ElasticAgentInstanceProfile
Expand Down
4 changes: 0 additions & 4 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ kustomizeEksOverlay := "deploy/kustomize/overlays/cloudbeat-eks"
kustomizeAwsOverlay := "deploy/kustomize/overlays/cloudbeat-aws"
cspPoliciesPkg := "github.com/elastic/csp-security-policies"
hermitActivationScript := "bin/activate-hermit"
AWS_DEFAULT_TAGS := 'Key=division,Value=engineering Key=org,Value=security Key=team,Value=cloud-security-posture Key=project,Value=test-environments'

# use env var if available
export LOCAL_GOARCH := `go env GOARCH`
Expand Down Expand Up @@ -130,9 +129,6 @@ deploy-dm:
delete-dm name:
gcloud deployment-manager deployments delete {{name}} -q

create-cnvm-stack-tags region stack_name tags=(AWS_DEFAULT_TAGS):
./scripts/add_cnvm_tags.sh {{region}} {{stack_name}} '{{tags}}'

build-kibana-docker:
node scripts/build --docker-images --skip-docker-ubi --skip-docker-centos -v

Expand Down
65 changes: 0 additions & 65 deletions scripts/add_cnvm_tags.sh

This file was deleted.

0 comments on commit 458b331

Please sign in to comment.